SUPPORT / SAMPLES & SAS NOTES
 

Support

Usage Note 22526: Testing and adjusting for unequal variances

DetailsAboutRate It

You can compare the variances of two populations using PROC TTEST. A folded F statistic testing the equality of the two variances is provided by default in the Equality of Variances table in the PROC TTEST results. The test assumes the response is normally distributed. For an example, see "Comparing Group Means" in the Getting Started section of the PROC TTEST documentation (SAS Note 22930).

The HOVTEST= option in the MEANS statement of the ANOVA and GLM procedures enables you to test the equality (homogeneity) of variances for one-way ANOVA models. The Bartlett, Brown-Forsythe, Levene (the default), and O'Brien variance tests are provided. You can also use the WELCH option in the MEANS statement in PROC GLM to perform Welch's ANOVA when the group variances are not assumed to be equal. Welch's ANOVA is robust to violation of the assumption of equal variances for one-way models. For example, the following statements request the Levene's test for homogeneity of variances and the Welch's ANOVA model:

     proc glm;
        class trt;
        model y = trt;
        means trt / hovtest=levene welch;
        run;

For an example, see "Testing for Equal Group Variances" in the Examples section of the PROC GLM documentation.

It is important to note that only the results from the HOVTEST= and WELCH options in PROC GLM account for variance heterogeneity. All other results assume equal variances.

The MIXED and GLIMMIX procedures are alternative procedures that have the ability to adjust for unequal variances. For example, in the statements below, the GROUP= option in the REPEATED statement allows you to estimate the variances separately. Therefore, all results will be adjusted for unequal variances. Adding the DDFM=SATTERTHWAITE option in the MODEL statement adjusts the degrees of freedom for the unequal variances:

     proc mixed;
        class trt;
        model y = trt / ddfm=satterth;
        repeated / group=trt;
        lsmeans trt / pdiff adjust=tukey;
        run;

It is also possible to model the variance at the same time that you model the mean response. You can then test for variance equality and assess which variables affect the variance. This can be done in PROC NLMIXED or by using the HETERO statement in PROC QLIM (in SAS/ETS®) as shown in SAS Note 70062.



Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemSAS/STATAlln/a
SAS SystemSAS/ETSMicrosoft Windows Server 2003 Enterprise Edition
Microsoft Windows Server 2003 Datacenter Edition
Microsoft Windows NT Workstation
Microsoft Windows 2000 Professional
Microsoft Windows 2000 Server
Microsoft Windows 2000 Datacenter Server
Microsoft Windows 2000 Advanced Server
Microsoft Windows 95/98
OS/2
Microsoft® Windows® for x64
Microsoft Windows XP 64-bit Edition
Microsoft Windows Server 2003 Enterprise 64-bit Edition
Microsoft Windows Server 2003 Datacenter 64-bit Edition
Microsoft® Windows® for 64-Bit Itanium-based Systems
OpenVMS VAX
z/OS
Microsoft Windows Server 2003 Standard Edition
Microsoft Windows Server 2003 for x64
Microsoft Windows Server 2008
Microsoft Windows Server 2008 for x64
Microsoft Windows XP Professional
Windows 7 Enterprise 32 bit
Windows 7 Enterprise x64
Windows 7 Home Premium 32 bit
Windows 7 Home Premium x64
Windows 7 Professional 32 bit
Windows 7 Professional x64
Windows 7 Ultimate 32 bit
Windows 7 Ultimate x64
Windows Millennium Edition (Me)
Windows Vista
Windows Vista for x64
64-bit Enabled AIX
64-bit Enabled HP-UX
64-bit Enabled Solaris
ABI+ for Intel Architecture
AIX
HP-UX
HP-UX IPF
IRIX
Linux
Linux for x64
Linux on Itanium
OpenVMS Alpha
OpenVMS on HP Integrity
Solaris
Solaris for x64
Tru64 UNIX
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.