Basic Concepts
We now show another test for homogeneity of variances using Bartlett’s test statistic B, which has an approximately chi-square distribution:
where k = number of groups, each of which contains nj elements, and s2 is the pooled variance, which as we have seen elsewhere is MSW, and
B can also be defined as follows:
Here MSW is the pooled variance across all groups. Thus the null hypothesis that all the group variances are equal is rejected if p-value < α where p-value = CHISQ.DIST.RT(B, k–1). B is only approximately chi-square, but the approximation should be good enough if there are at least 3 observations in each sample.
Bartlett’s test is very sensitive to departures from normality. If the samples come from non-normal distributions, then Bartlett’s test may simply be testing for non-normality. Levene’s test is less sensitive to departures from normality.
Example
Example 1: Use Bartlett’s test to determine whether the 4 samples in Example 2 of Basic Concepts for ANOVA have significantly different population variances.
Figure 1 – Bartlett’s test for the data in Example 1
We obtain Bartlett’s test statistic B (cell I6 of Figure 1) by calculating the numerator and denominator of B as described above (cells I4 and I5). To do this we first calculate the values dfj, 1/dfj, , and ln (cells in the range B13:E16). We also calculate dfW, 1/dfW, MSW, and ln MSW (cells in range F13:F16). Note that MSW = SUMPRODUCT(B13:E13,B15:E15)/F13 in cell F15.
Since p-value = CHISQ.DIST.RT(B, k–1) = CHISQ.DIST.RT(1.88, 3) = .979 > .05 = α, we don’t reject the null hypothesis, and so conclude there is no significant difference between the variances of the four methods.
Note that if we change the first sample for Method 4 to 185 (instead of 85) and repeat the analysis we would find that there would be a significant difference in the variances (B = 17.23, p-value = .001 < .05 = α). This would be due to this one outlier. That it was an outlier would show up easily in any graphic representation. We would then need to decide whether this item was simply an error in measurement or a true measurement (see Outliers in ANOVA).
Worksheet Function
Real Statistics Function: The Real Statistics Resource Pack provides the following function.
BARTLETT(R1) = p-value of Bartlett’s homogeneity of variances test on the data in range R1
For Example 1, we see that BARTLETT(B4:E11) = .979442.
Examples Workbook
Click here to download the Excel workbook with the examples described on this webpage.
References
NIST (2013) Bartlett’s test
https://www.itl.nist.gov/div898/handbook/eda/section3/eda357.htm#:~:text=Bartlett’s%20test%20(Snedecor%20and%20Cochran,equal%20across%20groups%20or%20samples.
All Things Statistics (2021) Bartletts test. Inferential Statistics
No longer available online
Wikipedia (2015) Bartlett’s test
https://en.wikipedia.org/wiki/Bartlett%27s_test
Hi prof. Charles.
Great article. Though it got me thinking – how does one prove that the test statistic, B, is approximately chi-squared? And do you by any chance have any sources related to this?
Thank you,
Lee Ki Faucet
Hello Lee,
Thank you for your kind remarks.
I am not familiar with the proof, but I believe that the following papers can be useful in answering your question:
Bartlett M. S. (1937). Properties of sufficiency and statistical tests. Proceedings of the Royal Society of London, Series A, 160, 268-282. Retrieved from http://www.jstor.org/stable/96803
Box GEP (1953) Non-normality and tests on variances. Biometrika 40:318–335
zbMATHMathSciNetGoogle Scholar
Charles
Hello, Charles. Great material.
Maybe I’m just dense, but is the Bartlett’s test example driven by a menu choice in the XRealStats macro? I can’t find it. Would Levene’s test (part of One Factor Anova) be a pretty good general substitute?
Hello John,
I haven’t included Bartlett’s test in the Real Statistics software since Levene’s test is more widely used and is probably a better choice for testing homogeneity of variance.
Actually, Bartlett’s test is a special case of Box’s test. Box’s test is supported in the Real Statistics software and is used for multivariate analysis.
Charles
Hi Charles,
Can you please clarify how should I set the parameters of Box’s test so that it runs like a Bartlett’s test?
Thanks in advance!
Hello Julio,
I tried to do this without success. Instead, I have now added a new worksheet function called BARTLETT that calculates the p-value of Bartlett’s test. This function will be available in the next release of the Real Statistics software. I expect this release to be issued next week.
Charles
Estimado profesor,
Entonces en lugar de usar la prueba de Bartlett para 03 grupos (datos con distribución normal), puedo usar la prueba de Levene? o recomienda Box?
Esa es mi duda, muchas gracias.
Hello Victor,
Usually it is best to use Levene’s test.
Charles
Thank you so much Sir for the info
Hi,
I would like to know how to perform the Bartlett test on a time series data which has a duration from 1940 to 2020. How do we divide the time series into multiple samples since we need at least 2 samples to conduct the Bartlett test
Hope you could provide some explanation on this
Thank you
Hi Kirthana,
I haven’t tried to tackle this issue in Real Statistics. Perhaps the Breusch–Pagan test can be used instead.
Breusch–Pagan test
The following articles may be helpful:
https://agupubs.onlinelibrary.wiley.com/doi/10.1029/2001WR000509
Charles
Thank you for the info Sir
Hi Prof Charles,
If I do testing with 4 certified materials (CRM) with different content and do some replicates for each CRM, is it OK to use RSD (CV) instead of variance to check the homogeneity using Bartlett? Thank you
(Maurits)
Hi Maurits,
If you are testing for homogeneity of variances to see whether this assumption is met prior to conducting ANOVA, then you will know the values for the group means and variances. Thus, there is no need to test homogeneity of CV’s, you might just as well test homogeneity of variances. You should test CV’s because the homogeneity of variance assumption is not met.
Charles
sir
How do you calculate variance in F16 ?
=LN(F15)
Charles
Dear Charles,
I have performed Shapiro-Wilk and Bartlett’s tests for normality and homoscedasticity. The first revealed that my data set is normal, but the second revealed heteroscedasticity. Then, I proceeded to Box-Cox transformation (linear transformation) and a new Bartlett’s test with the transformed data, but the non-uniformity of variances persists.
Any guess of what should I do now?
What is the main test that you are trying to perform? ANOVA? One-way? Two-way?
Charles
Dear Charles,
You know that Ln(0) is undefined. Therefore, if one of groups have variance of 0 (zero), can I perform Barttlett test?
Sincerely…
Serif,
As you say, if the variance is 0 then ln0 is undefined and so you can’t use this test.
Charles
sir, It gives the wrong result…
What are you referring to? What is the correct result?
Charles
Hello,
How do you calculate variance in F15 ?
Thanks for this website.
=SUMPRODUCT(B13:E13,B15:E15)/F13
Hi Chales, How did you calculate In(var)? I´m trying yo calculate it in Excel but I can´t do it. Can you explain me how to do it please?
Regards
The formula in Excel is =LN(var).
Charles
Hi charles,
how do you calculate df??
df = k-1 where k = the number of groups.
Charles
Dear Charles,
I have conducted a Potato varieties evaluation trial across three sites over two seasons and I’m struggling understanding the Homogeneity of variance. Could you help me out. I will send you the data through the email.
Hello Jonah,
You can email me your data. See Contact Us for my email address.
Why did you choose to use Bartlett’s test rather than Levene’s test?
Charles
Respected Charles Zaiontz
I want to know how to calculate In(var) in excel…such as in Exampe 1 of column A16
E.g. cell B15 contains the formula =LN(B14) and cell B14 contains the formula =VAR.S(B4:B11).
Charles
I did a combined analysis of 3 seasons field trial. With Barlett’s test the Chi square is 9.02 and Pr >Chi is 0.62. Does this mean that the variance is homogeneous? If so, I can present result of the average of 3 seaons?
Thanks in advance for you advise. used the 3 seasons
Maria,
If p-value = .62, then yes you can conclude that the variances are homogeneous (more correctly that you don’t have adequate evidence to conclude otherwise).
When you say “I can present result of the average of 3 seaons”, are you referring to the variances of each of the seasons or something else?
Charles
Thanks for your cooperation…..Best wishes to u…
How do you calculate the error variance? That is the part I’m really struggling with.
John,
What error variance are you referring to? Is it a cell in Figure 1?
Charles
Did you, by any chance, confuse the CHITEST with the CHIDIST function? When I introduce the former I get “#N/A”, whilst the latter does return a value.
Antonio,
Yes, you are correct. Thanks for catching this error. I have now corrected this mistake on the referenced webpage.
I really appreciate your help in improving the website.
Charles
how to creat bartlet’s table? or what is its fungtion in the ms. excell… help me please,, thanks……………………………………………………………………………………………………………….;
Dody,
Bartlett’s Test is equivalent to Box’s test when there are only two variables. The Real Statistics Resource Pack contains the function BOX, which implements this test. The MANOVA data analysis tool also implements this test. This is described on the webpage Box’s Test
Charles
Hi dear,
I thank you due to your good website in advance.
I ask of you if it is possible for you to explain statistical tests with SPSS software, please.
Or introduce to me website/websites where there be statistical works by SPSS.
Rasool,
Sorry, but I don’t use SPSS. There are lots of books and sites on the Internet that explain SPSS.
Charles
I would like to know that after getting a p value lower than .05 from doing the Bartlett’s test,Can we still proceed and do the T test?
Agatha,
Yes, just use the version of the test with unequal variances. In fact, you don’t really need to conduct Bartlett’s test in this case.
Charles
Thank you very much for your wonderful tool.
I did not find an option to perform a Bartlett’s test in the Real Statistics Toolpack. Is it because there is no such option or because I do not know where to look? (I do not have the required competences to add the above formulas in Excel…)
Thank you,
Andre
Andre,
Since Bartlett’s test is highly dependent on the data being normal, I tend not to use it and instead prefer Levene’s test of Fligner-Killeen test. For this reason I have not yet implemented the test in the form of Bartlett’s test. I have implemented instead the multivariate version of the test, namely Box’s Test.
Charles
Thank you very much for your reply.
I finally played around a bit and was able to reproduce the above Excel print-screens (except for the B-crit value).
As for the Bartlett’s test sensitivity to data normality, you are not the first person warning me about this. I however feel comfortable using this test because the procedure I use (as recommended by the reference person in my field) suggests removing outliers and transforming data to normalize the data as much as possible prior to performing the test.
Again, thank you for everything.