[英]2-way anova on unbalanced dataset
Is aov
appropriate for unbalanced datasets. aov
适用于不平衡的数据集。 According to help ...provides a wrapper to lm for fitting linear models to balanced or unbalanced experimental designs
. 根据帮助...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
. 但后来它说aov is designed for balanced designs, and the results can be hard to interpret without balance
。
How should I perform a 2-way anova on an unbalanced dataset in R? 我应该如何在R中的非平衡数据集上执行双向anova?
I would like to reproduce the different results for type I and type III sum of squares of SAS
output (when using proc glm
). 我想重现SAS
输出的I型和III型平方和的不同结果(当使用proc glm
)。 I remember we were using type III sum of squares
for unbalanced datasets. 我记得我们正在使用type III sum of squares
来表示非平衡数据集。
Thank you in advance. 先感谢您。
Function anova
(or summary.aov
) will give you the so called type I (or sequential) sum of squares. 函数anova
(或summary.aov
)将为您提供所谓的I型(或顺序)平方和。 To get type III sum of squares, you can use the Anova function from library car
with parameter type="III"
. 为了得到III型平方和的,你可以用方差分析 ,从库函数car
与参数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 . 这两个方法在不平衡数据集中的差异(以及生成两个表的R代码示例)在此处详细介绍。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.