非平衡数据集上的2向方差分析 [英] 2-way anova on unbalanced dataset
问题描述
aov
适用于不平衡的数据集.根据帮助...provides a wrapper to lm for fitting linear models to balanced or unbalanced experimental designs
.但稍后会说aov is designed for balanced designs, and the results can be hard to interpret without balance
.
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
时).我记得我们使用type III sum of squares
表示不平衡的数据集.
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.
谢谢.
推荐答案
函数anova
(或summary.aov
)将为您提供所谓的I型(或顺序)平方和.要获取III型平方和,您可以使用 Anova <库car
中的/a>函数,其参数为type="III"
.
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向方差分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!