GoogleSearch
이 블로그 검색
parametric anova for unequal variance + Bartlett Test of Homogeneity of Variances
라벨:
Informatics
이메일로 전송BlogThis!Twitter에서 공유Facebook에서 공유
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]
## Not assuming equal variances
oneway.test(extra ~ group, data = sleep)
## Assuming equal variances
oneway.test(extra ~ group, data = sleep, var.equal = TRUE)
## which gives the same result as
anova(lm(extra ~ group, data = sleep)) # not for (smallest var)*4 < (largest var)
Details
If x is a list, its elements are taken as the samples or fitted linear models to be compared for homogeneity of variances. In this case, the elements must either all be numeric data vectors or fitted linear model objects, g is ignored, and one can simply use bartlett.test(x) to perform the test. If the samples are not yet contained in a list, use bartlett.test(list(x, ...)).
Otherwise, x must be a numeric data vector, and g must be a vector or factor object of the same length as x giving the group for the corresponding elements of x.
Value
A list of class "htest" containing the following components:
statistic
Bartlett's K-squared test statistic.
parameter
the degrees of freedom of the approximate chi-squared distribution of the test statistic.
p.value
the p-value of the test.
method
the character string "Bartlett test of homogeneity of variances".
data.name
a character string giving the names of the data.
References
Bartlett, M. S. (1937). Properties of sufficiency and statistical tests. Proceedings of the Royal Society of London Series A 160, 268–282.
See Also
var.test for the special case of comparing variances in two samples from normal distributions; fligner.test for a rank-based (nonparametric) k-sample test for homogeneity of variances; ansari.test and mood.test for two rank based two-sample tests for difference in scale.
Examples
require(graphics)
plot(count ~ spray, data = InsectSprays)
bartlett.test(InsectSprays$count, InsectSprays$spray)
bartlett.test(count ~ spray, data = InsectSprays)
이메일로 전송BlogThis!Twitter에서 공유Facebook에서 공유
라벨:
Informatics
Scientist. Husband. Daddy. --- TOLLE. LEGE
외부자료의 인용에 있어 대한민국 저작권법(28조)과 U.S. Copyright Act (17 USC. §107)에 정의된 "저작권물의 공정한 이용원칙 | the U.S. fair use doctrine" 을 따릅니다. 저작권(© 최광민)이 명시된 모든 글과 번역문들에 대해 (1) 복제-배포, (2) 임의수정 및 자의적 본문 발췌, (3) 무단배포를 위한 화면캡처를 금하며, (4) 인용 시 URL 주소 만을 사용할 수 있습니다. [후원 | 운영] [대문으로] [방명록] [옛 방명록] [티스토리 (백업)] [신시내티]
-