Implementing heteroskedasticity-consistent standard errors in SPSS (and SAS)

Homoskedasticity (also spelled as Homoscedasticity), or constant variance of regression error terms, is a key assumption of ordinary least squares (OLS) regression. When this assumption is violated, i.e. the errors are heteroskedastic (or heteroscedastic), the regression estimator is unbiased and consistent. However, it is less efficient and this leads to Type I error inflation or reduced statistical power for coefficient hypothesis tests.

Thus correcting for heteroskedasticity is necessary while conducting OLS. There are methods for this, which include transforming the data, use of weighted least squares (WLS) regression and generalized least squares (GLS) estimation. Another alternative is to use  heteroskedasticity-consistent standard error (HCSE) estimators of OLS parameter estimates (White, 1980).

Comparison of residuals between first order He...

Comparison of residuals between first order Heteroskedastic and Homoskedastic disturbances (Photo credit: Wikipedia)

HCSE are of four types. Standard errors from HC0 (the most common implementation) are best used for large sample sizes as these estimators are downward biased for small sample sizes. HC1, HC2, and HC3 estimators are better used for smaller samples.

Many researchers conduct their statistical analysis in STATA, which has in-built procedures for estimating standard errors using all of the HC methods. However, others use SPSS due to its pair-wise deletion capability (versus list-wise deletion in STATA) and suffer from its  lack of heteroskedasticity correction capabilities. This wonderful paper by Hayes and Cai, provides a macro (in the Appendix) that can implement HCSE estimators in SPSS. They also provide a similar macro for SAS.

Note that the macro has no error-handling procedures, hence pre-screening of the data is required. Also, missing data is handled by list-wise deletion (which might defeat the purpose of using SPSS for some users).

Another link to the paper is here.


Hayes, A.F. and Cai, L. (2007) , “Using heteroskedasticity-consistent standard error estimators in OLS regression: An introduction and software implementation”, Behavior Research Methods, 39 – 4, 709-722, DOI: 10.3758/BF03192961.

White, H. (1980), “A Heteroscedasticity-Consistent Covariance Matrix Estimator and a Direct Test for Heteroscedasticity,” Econometrica, 48, 817-838.


Factor Analysis in Stata

Conducting Exploratory Factor Analysis in Stata is relatively straight forward. Run the factor command, followed by the rotate command. There are also other post-estimation commands. For examples of running EFA in Stata, go here or here. Running a Confirmatory Factor Analysis in Stata is a little more complicated. A cfa module, which is maintained and updated by Stanislav Kolenikov, can be downloaded by running the following command in Stata:


net from


The command syntax is:

The accompanying paper which contains the description of the commands and illustrative examples is here -> cfa-sj-kolenikov.



Stata Annotated Output: Factor Analysis. UCLA: Academic Technology Services, Statistical Consulting Group.

from (accessed October 14, 2011).


John B. Willett, Conducting Exploratory Factor Analyses, in Selected Multivariate Data-Analytic Methods.

from (accessed October 14, 2011).


Stanislav Kolenikov, Confi rmatory factor analysis using cfa.

from (accessed October 14, 2011).