本文介绍了如何从"aov"提取系数的标准误差.模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一个aov模型,我只想提取每个系数的标准误差.

I did a aov model and I just want to extract the standard errors of each coefficient.

model <- aov(Molecule ~  Comorbidity + Age + BMI + Sex, data = mydata)

我可以通过以下方式查看估计的边际均值:

I can see the estimated marginal mean with:

allEffects(model)

但是我无法提取每个系数的标准误差.我在互联网上看到功能se.coef(),但是它不起作用. summary(model)$coefficients[, "Std. Error"]也不起作用.

But I can't extract standard error of each coefficient. I saw on the internet the function se.coef() but it doesn't work. summary(model)$coefficients[, "Std. Error"] does not work either.

我已经阅读了effects和其他软件包,但是找不到我想要的东西.有什么主意吗?

I've read effects and other packages, but I don't find what I want. Any idea?

推荐答案

summary使用lm方法:

coef(summary.lm(model))

这将为所有可识别系数提供4列的系数表/矩阵(平均值,标准误差,t值,p值).然后,您可以提取第二列以获取标准错误.

This will give a coefficient table / matrix of 4 columns (mean, standard error, t-value, p-value) for all identifiable coefficients. Then you can extract the 2nd column for standard error.

aov返回主类"aov"的对象,但返回辅助类"lm"的对象,因此,summary.aovsummary.lm都适用,但给出了不同的内容.当您简单地执行summary(model)时,前者被称为S3方法分派的结果.

aov returns object of primary class "aov" but secondary class "lm", hence both summary.aov and summary.lm apply but gives different things. When you simply do summary(model), the former is called as the result of S3 method dispatching.

这篇关于如何从"aov"提取系数的标准误差.模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-09 23:42