Homogeneity of Variance Tests For Two or More Groups

We covered this topic for two-group designs earlier. Basically, one transforms the scores so that between groups variance in the scores reflects differences in variance rather than differences in means. Then one does a t test on the transformed scores. If there are three or more groups, simply replace the t test with an ANOVA.

See the discussion in the Engineering Statistics Handbook. Levene suggested transforming the scores by subtracting the within-group mean from each score and then either taking the absolute value of each deviation or squaring each deviation. Both versions are available in SAS. Brown and Forsythe recommended using absolute deviations from the median or from a trimmed mean. Their Monte Carlo research indicated that the trimmed mean was the best choice when the populations were heavy in their tails and the median was the best choice when the populations were skewed. The Brown and Forsythe method using the median is available in SAS. It would not be very difficult to program SAS to use the trimmed means. Obrien’s test is also available in SAS.

I provide here SAS code to illustrate homogeneity of variance tests. The data are the gear data from the Engineering Statistics Handbook.

optionspageno=min nodateformdlim='-';

title'Homogeneity of Variance Tests';

title2'See run;

dataLevene;

input Batch N; Do I=1to N; InputGearDiameter @@; output; end;

cards;

1 10

1.006 0.996 0.998 1.000 0.992 0.993 1.002 0.999 0.994 1.000

2 10

0.998 1.006 1.000 1.002 0.997 0.998 0.996 1.000 1.006 0.988

3 10

0.991 0.987 0.997 0.999 0.995 0.994 1.000 0.999 0.996 0.996

4 10

1.005 1.002 0.994 1.000 0.995 0.994 0.998 0.996 1.002 0.996

5 10

0.998 0.998 0.982 0.990 1.002 0.984 0.996 0.993 0.980 0.996

6 10

1.009 1.013 1.009 0.997 0.988 1.002 0.995 0.998 0.981 0.996

7 10

0.990 1.004 0.996 1.001 0.998 1.000 1.018 1.010 0.996 1.002

8 10

0.998 1.000 1.006 1.000 1.002 0.996 0.998 0.996 1.002 1.006

9 10

1.002 0.998 0.996 0.995 0.996 1.004 1.004 0.998 0.999 0.991

10 10

0.991 0.995 0.984 0.994 0.997 0.997 0.991 0.998 1.004 0.997

*****************************************************************************;

procGLMdata=Levene; class Batch;

modelGearDiameter = Batch / ss1;

means Batch / hovtest=levenehovtest=BF hovtest=obrien;

title; run;

*****************************************************************************;

procGLMdata=Levene; class Batch;

modelGearDiameter = Batch / ss1;

means Batch / hovtest=levene(type=ABS); run;

Here are parts of the statistical output, with annotations:

Levene's Test for Homogeneity of GearDiameter Variance

ANOVA of Squared Deviations from Group Means

Sum of Mean

Source DF Squares Square F Value Pr > F

Batch 9 5.755E-8 6.394E-9 2.50 0.0133

Error 90 2.3E-7 2.556E-9

With the default Levene’s test (using squared deviations), the groups differ significantly in variances.

O'Brien's Test for Homogeneity of GearDiameter Variance

ANOVA of O'Brien's Spread Variable, W = 0.5

Sum of Mean

Source DF Squares Square F Value Pr > F

Batch 9 7.105E-8 7.894E-9 2.22 0.0279

Error 90 3.205E-7 3.562E-9

Also significant with Obrien’s Test.

Brown and Forsythe's Test for Homogeneity of GearDiameter Variance

ANOVA of Absolute Deviations from Group Medians

But not significant with the Brown & Forsythe test using absolute deviations from within-group medians.

Sum of Mean

Source DF Squares Square F Value Pr > F

Batch 9 0.000227 0.000025 1.71 0.0991

Error 90 0.00133 0.000015

------

SAS will only let you do one Levene test per invocation of PROC GLM, so I ran GLM a second time to get the Levene test with absolute deviations. As you can see below, the difference in variances is significant with this test.

Levene's Test for Homogeneity of GearDiameter Variance

ANOVA of Absolute Deviations from Group Means

Sum of Mean

Source DF Squares Square F Value Pr > F

Batch 9 0.000241 0.000027 2.16 0.0322

Error 90 0.00112 0.000012

The One-Way ANOVA procedure in SPSS also provides atest of homogeneity of variance, as shown below.

Test of Homogeneity of Variances
GearDiameter
Levene Statistic / df1 / df2 / Sig.
2.159 / 9 / 90 / .032

Notice that the Levene test provided by PASW is that using absolute deviations from within-group means. The Brown-Forsythe test offered as an option is not their test of equality of variances, it is a robust test of differences among means, like the Welch test.

Return to Wuensch’s Statistics Lessons Page

Karl L. Wuensch
December, 2011.