问题描述
aov
是否适用于不平衡的数据集.根据帮助...为lm提供了一个包装器,用于将线性模型拟合到平衡或不平衡的实验设计
.但后来它说aov 是为平衡设计而设计的,如果没有平衡,结果可能很难解释
.
Is aov
appropriate for unbalanced datasets. According to help ...provides a wrapper to lm for fitting linear models to balanced or unbalanced experimental designs
. But later on it says aov is designed for balanced designs, and the results can be hard to interpret without balance
.
我应该如何对 R 中的不平衡数据集执行 2 向方差分析?
How should I perform a 2-way anova on an unbalanced dataset in R?
我想重现 SAS
输出的 I 型和 III 型平方和的不同结果(使用 proc glm
时).我记得我们对不平衡数据集使用 III 型平方和
.
I would like to reproduce the different results for type I and type III sum of squares of SAS
output (when using proc glm
). I remember we were using type III sum of squares
for unbalanced datasets.
提前致谢.
推荐答案
Function anova
(或 summary.aov
)会给你所谓的类型 I(或序列) 平方和.要获得类型 III 的平方和,您可以使用 Anova 函数来自库 car
,参数为 type="III"
.这两种方法在不平衡数据集(以及生成两个表的示例 R 代码)中的区别在此处.
Function anova
(or summary.aov
) will give you the so called type I (or sequential) sum of squares. To get type III sum of squares, you can use the Anova function from library car
with parameter type="III"
. The difference between these two approaches in unbalanced datasets (and also sample R code to produce both tables) is presented in detail here.
这篇关于不平衡数据集上的 2 路方差分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!