# Understanding the results of Bartlett's test of homoscedasticity in ANOVA

I want to conduct one-way ANOVA for this data:

# three factor levels
I <- c(19, 22, 20, 18, 25, 21, 24, 17)
II <- c(20, 21, 33, 27, 29, 30, 22, 23)
III <- c(16, 15, 18, 26, 17, 23, 20, 19)

# making a dataframe from data
response <- c(I, II, III)
factor <- c(rep("I", length(I)), rep("II", length(II)), rep("III", length(III)))
(data1 <- data.frame(response, factor))


So firstly, I check the boxplot for every factor level:

# making a side-by-side boxplots
plot(response ~ factor, data1)


and see that variance for level II is much higher than for I and II, so I suspect that Bartlett's test will reject the null hypothesis about the equality of variances.

I also check the exact value of these variances and see that the second one is significantly different from the others (22,83):

tapply(data1$response, data1$factor, var)
#      I        II       III
#  7.928571 22.839286 13.642857


Then I check the normality of response, it's ok:

# testing for normality
qqnorm(data1$response) qqline(data1$response)


if(shapiro.test(kalkulator$reakcja)$p.value >= 0.01){
cat("No reason to reject null hypothesis")
}else {
cat("This distribution isn't normal")
}
# No reason to reject null hypothesis


So I finally go to Bartlett's test:

# testing for homoscedasticity
bartlett.test(response ~ factor, data1)

# Bartlett test of homogeneity of variances

# data:  response by factor
# Bartlett's K-squared = 1.7932, df = 2, p-value = 0.408


And see that there's no reason to reject null hypothesis. I know of course, that this statement isn't equal to "null hypothesis is true", but I have here significant difference in variances and still this test is passed. Why? And should I assume that there is homogeneity of variances and go on with ANOVA? Thanks for taking your time :)

• I would do a Levene test instead of a Bartlett test. Nov 1 '15 at 9:49
• On what basis do you assert significance when you say: "see that the second one is significantly different from the others"? Nov 1 '15 at 10:50
• Just comparing these values, nothing formal ( maybe that's the case ) - I think that when second variance is almost three times greater than first one and one and a half greater than the third one, then I can't assume that they are equal :) Nov 1 '15 at 11:30
• Echoing some of the other comments, with 8 data points, why even be surprised that the test is not significant? Estimate the power of this test to reject Ho instead. Nov 1 '15 at 13:48