parametric ANOVA with unequal variances

家住魔仙堡 提交于 2019-12-23 16:43:31

问题


I was wondering if there is a way in R to do an ANOVA with unequal variances?

Imagine the following example:

x <- c(10,11,15,8,16,12,20)
y <- c(10,14,18,25,28,30,35)

d <- c(x,y)
f <- as.factor(c(rep("a",7), rep("b",7)))

# Unequal variance:

t.test(x,y)$p.value
t.test(d~f)$p.value

# Equal variance:

t.test(x,y, var.equal=TRUE)$p.value
t.test(d~f, var.equal=TRUE)$p.value

anova(lm(d~f))[[5]]
summary(aov(lm(d~f)))[[1]][5]
summary(lm(d~f))[[4]][8]

As you can see from this example the different ways of performing an ANOVA in R, in case of two groups only, always result in a p-value identical to the one obtained by a t.test with equal variances. Again, is there a way to perform an ANOVA with unequal variances?


回答1:


For this case there is oneway.test()

R> oneway.test(d~f)

    One-way analysis of means (not assuming equal variances)

data:  d and f 
F = 6.631, num df = 1.000, denom df = 8.339, p-value = 0.03179


来源:https://stackoverflow.com/questions/11816948/parametric-anova-with-unequal-variances

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!