本文介绍了如何从“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?

推荐答案

使用lm方法进行summary:

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:47