Bartlett's Test for Homogeneity of Variance

Bartlett's test is used to test the assumption that variances are equal (i.e., homogeneous) across groups. The test is easy to implement and produces valid results, assuming data points within groups are randomly sampled from a normal distribution.

Because Bartlett's test is sensitive to departures from normality, a normality test is prudent. Several ways to check for departures from normality are described at: How to Test for Normality: Three Simple Tests.

Note: Unlike Hartley's Fmax test, which also tests for homogeneity, Bartlett's test does not assume equal sample sizes across groups.

Hypothesis Testing

Bartlett's test is an actual hypothesis test, where we examine observed data to choose between two statistical hypotheses:

  • Null hypothesis: Variance ( σ2 ) is equal across all groups.

    H0: σ2i = σ2j for all groups

  • Alternative hypothesis: Variance is not equal across all groups.

    H1: σ2i ≠ σ2j for at least one pair of groups

Like many other techniques for testing hypotheses, Bartlett's test for homogeneity involves computing a test-statistic and finding the P-value for the test statistic, given degrees of freedom and significance level. If the P-value is bigger than the significance level, we accept the null hypothesis; if it is smaller, we reject the null hypothesis.

How to Conduct Bartlett's Test

The steps required to conduct Bartlett's test for homogeneity are detailed below:

  • Step 1. Specify the significance level ( α ).
  • Step 2. Compute the sample variance ( s2j ) for each group.
     
    kΣj=1
    ( X i, j - X j ) 2
    s2j =
    ( n j - 1 )

    where X i, j is the score for observation i in Group j , X j is the mean of Group j, n j is the number of observations in Group j , and k is the number of groups.

  • Step 3. Compute the pooled estimate of sample variance ( s2p ).

    n = Σ n i

     
    kΣj=1
    ( n j - 1 ) s2j 
    s2p = 
    ( n - k )

    where n j is the sample size in Group j , k is the number of groups, n is the total sample size, and s2j is the sample variance in Group  j.

  • Step 4. Compute the test statistic (T).

    A = ( n - k ) * ln( s2p )

    B = Σ [ ( n j - 1 ) * ln( s2j ) ]

    C = 1 / [ 3 * ( k - 1 ) ]

    D = Σ [ 1 / ( n j - 1 ) - 1 / ( n - k ) ]

    T = ( A - B ) / [ 1 + ( C * D ) ]

    where A is the first term in the numerator of the test statistic, B is the second term in the numerator, C is the first term in the denominator , D is the second term in the denominator, and ln is the natural logarithm.

  • Step 5. Find the degrees of freedom ( df ), based on the number of groups ( k ).

    df = k - 1

  • Step 7. Find the P-value for the test statistic. The P-value is the probability of seeing a test statistic more extreme (bigger) than the observed T statistic from Step 4.

    It turns out that the test statistic (T) is distributed much like a chi-square statistic with ( k-1 ) degrees of freedom. Knowing the value of T and the degrees of freedom associated with T, we can use Stat Trek's Chi-Square Calculator to find the P-value - the probability of seeing a test statistic more extreme than T.

  • Step 7. Accept or reject the null hypothesis, based on P-value and significance level. If the P-value is bigger than the significance level, we accept the null hypothesis that variances are equal across groups. Otherwise, we reject the null hypothesis.

So you will understand how to accomplish each step, let's work through an example, one step at a time.

Example 1

The table below shows sample data for five groups. Based on the data, would you say that group variances are homogeneous?

Group 1 Group 2 Group 3 Group 4 Group 5
1
2
3
4
5
1
3
5
7
9
1
4
7
10
13
1
5
9
13
17
1
6
11
16
21

We will use Bartlett's test to test the assumption that variances are equal across groups.

Specify Significance Level

The significance level is the probability of rejecting the null hypothesis when it is true. Researchers often choose 0.05 or 0.01 for a significance level. For the purpose of this exercise, let's choose 0.05.

Compute Sample Variance

Using the formula below, we compute sample variance:

 
kΣj=1
( X i, j - X j ) 2
s2j =
( n j - 1 )

The variance for each group is shown below:

Variance
Group 1 Group 2 Group 3 Group 4 Group 5
2.5 10 22.5 40 62.5

Compute Pooled Estimate of Variance

To compute the pooled estimate of sample variance, we use the formula below:

 
kΣj=1
( n j - 1 ) s2j 
s2p = 
( n - k )

s2p = 27.5

Compute the Test Statistic (T)

To compute the test statistic (T), we use the following formulas:

A = ( n - k ) * ln( s2p ) = 66.284

B = Σ ( n j - 1 ) * ln( s2j ) = 56.626

C = 1 / [ 3 * ( k - 1 ) ] = 0.083

D = Σ [ 1 / ( n j - 1 ) ] - [ 1 / ( n - k ) ] = 1.0

T = ( A - B ) / [ 1 + ( C * D ) ]

T = (66.284 - 56.626) / [1 + (0.083 * 1.2)] = 8.92

Find Degrees of Freedom

Compute degrees of freedom ( df ), based on the number of groups ( k ).

df = k - 1 = 5 - 1 = 4

Find P-Value

The P-value is the probability of seeing a test statistic (T) that is more extreme (bigger) than the observed test statistic. For this problem, we found that the observed test statistic was 8.92. And we know the test statistic follows a chi-square distribution. Therefore, we want to know the probability of seeing a chi-square test statistic bigger than 8.92

Use Stat Trek's Chi-Square Calculator to find that probability. Enter the degrees of freedom (4) and the observed test statistic (8.92) into the calculator; then, click the Calculate button.

From the calculator, we see that P( T > 8.92 ) equals 0.06; so the P-Value is 0.06.

Test the Null Hypothesis

When the P-Value is bigger than the significance level, we cannot reject the null hypothesis. When it is smaller, we cannot accept the null hypothesis.

Here, the P-Value (0.06) is bigger than the significance level (0.05), so we accept the null hypothesis that the data tested follows a normal distribution.

Other Options

To illustrate exactly how Bartlett's test works, we solved the problem above manually, executing each step by hand. That is useful for understanding, but it is also laborious and time-consuming. Here are two easier ways to solve the same problem:

  • Use the Bartlett's Test Calculator. The Bartlett's Test Calculator makes it easy. You enter a few inputs, and the calculator handles all the computations. To see how to solve the above problem with the calculator, go to Bartlett's Test Calculator: Problem 1.
  • Try Hartley's Fmax test. Other tests, such as Hartley's Fmax test, can also be used to test for homogeneity of variance. For comparison, we applied Hartley's Fmax test to above problem. If you're curious to see whether Bartlett's test agreed with Hartley's test, go to Hartley's Fmax Test of Normality: Example 1.