MODEL Procedure

Heteroscedasticity

One of the key assumptions of regression is that the variance of the errors is constant across observations. If the errors have constant variance, the errors are called homoscedastic. Typically, residuals are plotted to assess this assumption. Standard estimation methods are inefficient when the errors are heteroscedastic or have nonconstant variance.

Heteroscedasticity Tests

The MODEL procedure provides two tests for heteroscedasticity of the errors: White’s test and the modified Breusch-Pagan test.

Both White’s test and the Breusch-Pagan are based on the residuals of the fitted model. For systems of equations, these tests are computed separately for the residuals of each equation.

The residuals of an estimation are used to investigate the heteroscedasticity of the true disturbances.

The WHITE option tests the null hypothesis

upper H 0 colon sigma Subscript i Superscript 2 Baseline equals sigma squared normal f normal o normal r normal a normal l normal l i

White’s test is general because it makes no assumptions about the form of the heteroscedasticity (White 1980). Because of its generality, White’s test might identify specification errors other than heteroscedasticity (Thursby 1982). Thus, White’s test might be significant when the errors are homoscedastic but the model is misspecified in other ways.

White’s test is equivalent to obtaining the error sum of squares for the regression of squared residuals on a constant and all the unique variables in bold upper J circled-times bold upper J, where the matrix J is composed of the partial derivatives of the equation residual with respect to the estimated parameters. White’s test statistic W is computed as

upper W equals n upper R squared

where upper R squared is the correlation coefficient obtained from the preceding regression. The statistic is asymptotically distributed as chi-squared with upper P minus 1 degrees of freedom, where P is the number of regressors in the regression, including the constant, and n is the total number of observations. In the example that follows, the regressors are constant, income, income*income, income*income*income, and income*income*income*income. The regressor income*income occurs twice, and one is dropped. Hence, upper P equals 5 with degrees of freedom upper P minus 1 equals 4.

Note that White’s test in the MODEL procedure is different from White’s test in the REG procedure requested by the SPEC option. The SPEC option produces the test from Theorem 2 on page 823 of White (1980). The WHITE option, on the other hand, produces the statistic discussed in Greene (1993).

The null hypothesis for the modified Breusch-Pagan test is homoscedasticity. The alternate hypothesis is that the error variance varies with a set of regressors, which are listed in the BREUSCH= option.

Define the matrix bold upper Z to be composed of the values of the variables listed in the BREUSCH= option, such that z Subscript i comma j is the value of the jth variable in the BREUSCH= option for the ith observation. The null hypothesis of the Breusch-Pagan test is

sigma Subscript i Superscript 2 Baseline equals sigma squared left-parenthesis alpha 0 plus bold-italic alpha Superscript Super Superscript prime Superscript Baseline z Subscript i Baseline right-parenthesis upper H 0 colon bold-italic alpha equals bold 0

where sigma Subscript i Superscript 2 is the error variance for the ith observation and alpha 0 and bold-italic alpha are regression coefficients.

The test statistic for the Breusch-Pagan test is

b p equals StartFraction 1 Over v EndFraction left-parenthesis bold u minus u overbar bold i right-parenthesis Superscript prime Baseline bold upper Z left-parenthesis bold upper Z Superscript prime Baseline bold upper Z right-parenthesis Superscript negative 1 Baseline bold upper Z Superscript prime Baseline left-parenthesis bold u minus u overbar bold i right-parenthesis

where bold u equals left-parenthesis e 1 squared comma e 2 squared comma ellipsis comma e Subscript n Superscript 2 Baseline right-parenthesis, bold i is an n times 1 vector of ones, and

v equals StartFraction 1 Over n EndFraction sigma-summation Underscript i equals 1 Overscript n Endscripts left-parenthesis e Subscript i Superscript 2 Baseline minus StartFraction bold e Superscript prime Baseline bold e Over n EndFraction right-parenthesis squared

This is a modified version of the Breusch-Pagan test, which is less sensitive to the assumption of normality than the original test (Greene 1993, p. 395).

The statements in the following example produce the output in Figure 41:

proc model data=schools;
   parms const inc inc2;

   exp = const + inc * income + inc2 * income * income;
   incsq = income * income;

   fit exp / white breusch=(1 income incsq);
run;

Figure 41: Output for Heteroscedasticity Tests

The MODEL Procedure

Heteroscedasticity Test
Equation Test Statistic DF Pr > ChiSq Variables
exp White's Test 21.16 4 0.0003 Cross of all vars
  Breusch-Pagan 15.83 2 0.0004 1, income, incsq


Correcting for Heteroscedasticity

There are two methods for improving the efficiency of the parameter estimation in the presence of heteroscedastic errors. If the error variance relationships are known, weighted regression can be used or an error model can be estimated. For more information about error model estimation, see the section Error Covariance Structure Specification. If the error variance relationship is unknown, GMM estimation can be used.

Weighted Regression

The WEIGHT statement can be used to correct for the heteroscedasticity. Consider the following model, which has a heteroscedastic error term:

y Subscript t Baseline equals 250 left-parenthesis e Superscript minus 0.2 t Baseline minus e Superscript minus 0.8 t Baseline right-parenthesis plus StartRoot left-parenthesis 9 slash t right-parenthesis EndRoot epsilon Subscript t

The data for this model are generated with the following SAS statements:

data test;
   do t=1 to 25;
      y = 250 * (exp( -0.2 * t ) - exp( -0.8 * t )) +
          sqrt( 9 / t ) * rannor(1);
      output;
   end;
run;

If this model is estimated with OLS, as shown in the following statements, the estimates shown in Figure 42 are obtained for the parameters:

proc model data=test;
   parms b1 0.1 b2 0.9;
   y = 250 * ( exp( -b1 * t ) - exp( -b2 * t ) );
   fit y;
run;

Figure 42: Unweighted OLS Estimates

The MODEL Procedure

Nonlinear OLS Parameter Estimates
Parameter Estimate Approx Std Err t Value Approx
Pr > |t|
b1 0.200977 0.00101 198.60 <.0001
b2 0.826236 0.00853 96.82 <.0001


If both sides of the model equation are multiplied by StartRoot t EndRoot, the model has a homoscedastic error term. This multiplication or weighting is done through the WEIGHT statement. The WEIGHT statement variable operates on the squared residuals as

bold-italic epsilon Subscript t Superscript prime Baseline bold-italic epsilon Subscript t Baseline equals normal w normal e normal i normal g normal h normal t times bold q Subscript t Superscript prime Baseline bold q Subscript t

so that the WEIGHT statement variable represents the square of the model multiplier. The following PROC MODEL statements corrects the heteroscedasticity with a WEIGHT statement:

proc model data=test;
   parms b1 0.1 b2 0.9;
   y = 250 * ( exp( -b1 * t ) - exp( -b2 * t ) );
   fit y;
   weight t;
run;

Note that the WEIGHT statement follows the FIT statement. The weighted estimates are shown in Figure 43.

Figure 43: Weighted OLS Estimates

The MODEL Procedure

Nonlinear OLS Parameter Estimates
Parameter Estimate Approx Std Err t Value Approx
Pr > |t|
b1 0.200503 0.000844 237.53 <.0001
b2 0.816701 0.0139 58.71 <.0001


The weighted OLS estimates are identical to the output produced by the following PROC MODEL example:

proc model data=test;
   parms b1 0.1 b2 0.9;
   y = 250 * ( exp( -b1 * t ) - exp( -b2 * t ) );
  _weight_ = t;
   fit y;
run;

If the WEIGHT statement is used in conjunction with the _WEIGHT_ variable, the two values are multiplied together to obtain the weight used.

The WEIGHT statement and the _WEIGHT_ variable operate on all the residuals in a system of equations. If a subset of the equations needs to be weighted, the residuals for each equation can be modified through the RESID. variable for each equation. The following example demonstrates the use of the RESID. variable to make a homoscedastic error term:

proc model data=test;
   parms b1 0.1 b2 0.9;
   y = 250 * ( exp( -b1 * t ) - exp( -b2 * t ) );
   resid.y = resid.y * sqrt(t);
   fit y;
run;

These statements produce estimates of the parameters and standard errors that are identical to the weighted OLS estimates. The reassignment of the RESID.Y variable must be done after Y is assigned; otherwise it would have no effect. Also, note that the residual (RESID.Y) is multiplied by StartRoot t EndRoot. Here the multiplier is acting on the residual before it is squared.

GMM Estimation

If the form of the heteroscedasticity is unknown, generalized method of moments estimation (GMM) can be used. The following PROC MODEL statements use GMM to estimate the example model used in the preceding section:

proc model data=test;
   parms b1 0.1 b2 0.9;
   y = 250 * ( exp( -b1 * t ) - exp( -b2 * t ) );
   fit y / gmm;
   instruments b1 b2;
run;

GMM is an instrumental method, so instrument variables must be provided.

GMM estimation generates estimates for the parameters shown in Figure 44.

Figure 44: GMM Estimation for Heteroscedasticity

The MODEL Procedure

Nonlinear GMM Parameter Estimates
Parameter Estimate Approx Std Err t Value Approx
Pr > |t|
b1 0.200487 0.000800 250.69 <.0001
b2 0.822148 0.0148 55.39 <.0001


Heteroscedasticity-Consistent Covariance Matrix Estimation

Homoscedasticity is required for ordinary least squares regression estimates to be efficient. A nonconstant error variance, heteroscedasticity, causes the OLS estimates to be inefficient, and the usual OLS covariance matrix, ModifyingAbove bold upper Sigma With caret, is generally invalid:

ModifyingAbove bold upper Sigma With caret equals sigma squared left-parenthesis bold upper X prime bold upper X right-parenthesis Superscript negative 1

When the variance of the errors of a classical linear model

upper Y equals bold upper X beta plus epsilon

is not constant across observations (heteroscedastic), so that sigma Subscript i Superscript 2 Baseline not-equals sigma Subscript j Superscript 2 for some j greater-than 1, the OLS estimator

ModifyingAbove beta With caret Subscript normal upper O normal upper L normal upper S Baseline equals left-parenthesis bold upper X prime bold upper X right-parenthesis Superscript negative 1 Baseline bold upper X prime upper Y

is unbiased but it is inefficient. Models that take into account the changing variance can make more efficient use of the data. When the variances, sigma Subscript t Superscript 2, are known, generalized least squares (GLS) can be used and the estimator

ModifyingAbove beta With caret Subscript normal upper G normal upper L normal upper S Baseline equals left-parenthesis bold upper X prime bold upper Omega bold upper X right-parenthesis Superscript negative 1 Baseline bold upper X prime bold upper Omega Superscript negative 1 Baseline upper Y

where

bold upper Omega equals Start 4 By 4 Matrix 1st Row 1st Column sigma 1 squared 2nd Column 0 3rd Column 0 4th Column 0 2nd Row 1st Column 0 2nd Column sigma 2 squared 3rd Column 0 4th Column 0 3rd Row 1st Column 0 2nd Column 0 3rd Column down-right-diagonal-ellipsis 4th Column 0 4th Row 1st Column 0 2nd Column 0 3rd Column 0 4th Column sigma Subscript upper T Superscript 2 EndMatrix

is unbiased and efficient. However, GLS is unavailable when the variances, sigma Subscript t Superscript 2, are unknown.

To solve this problem White (1980) proposed a heteroscedastic consistent-covariance matrix estimator (HCCME)

ModifyingAbove bold upper Sigma With caret equals left-parenthesis bold upper X prime bold upper X right-parenthesis Superscript negative 1 Baseline bold upper X prime ModifyingAbove bold upper Omega With caret bold upper X left-parenthesis bold upper X prime bold upper X right-parenthesis Superscript negative 1

that is consistent as well as unbiased, where

ModifyingAbove bold upper Omega With caret Subscript 0 Baseline equals Start 4 By 4 Matrix 1st Row 1st Column epsilon 1 squared 2nd Column 0 3rd Column 0 4th Column 0 2nd Row 1st Column 0 2nd Column epsilon 2 squared 3rd Column 0 4th Column 0 3rd Row 1st Column 0 2nd Column 0 3rd Column down-right-diagonal-ellipsis 4th Column 0 4th Row 1st Column 0 2nd Column 0 3rd Column 0 4th Column epsilon Subscript upper T Superscript 2 EndMatrix

and epsilon Subscript t Baseline equals upper Y Subscript t Baseline minus bold upper X Subscript t Baseline ModifyingAbove beta Subscript normal upper O normal upper L normal upper S Baseline With caret.

This estimator is considered somewhat unreliable in finite samples. Therefore, Davidson and MacKinnon (1993) propose three different modifications to estimating ModifyingAbove bold upper Omega With caret. The first solution is to simply multiply epsilon Subscript t Superscript 2 by StartFraction n Over n minus d f EndFraction, where n is the number of observations and df is the number of explanatory variables, so that

ModifyingAbove bold upper Omega With caret Subscript 1 Baseline equals Start 4 By 4 Matrix 1st Row 1st Column StartFraction n Over n minus d f EndFraction epsilon 1 squared 2nd Column 0 3rd Column 0 4th Column 0 2nd Row 1st Column 0 2nd Column StartFraction n Over n minus d f EndFraction epsilon 2 squared 3rd Column 0 4th Column 0 3rd Row 1st Column 0 2nd Column 0 3rd Column down-right-diagonal-ellipsis 4th Column 0 4th Row 1st Column 0 2nd Column 0 3rd Column 0 4th Column StartFraction n Over n minus d f EndFraction epsilon Subscript n Superscript 2 EndMatrix

The second solution is to define

ModifyingAbove bold upper Omega With caret Subscript 2 Baseline equals Start 4 By 4 Matrix 1st Row 1st Column StartFraction epsilon 1 squared Over 1 minus ModifyingAbove h With caret Subscript 1 Baseline EndFraction 2nd Column 0 3rd Column 0 4th Column 0 2nd Row 1st Column 0 2nd Column StartFraction epsilon 2 squared Over 1 minus ModifyingAbove h With caret Subscript 2 Baseline EndFraction 3rd Column 0 4th Column 0 3rd Row 1st Column 0 2nd Column 0 3rd Column down-right-diagonal-ellipsis 4th Column 0 4th Row 1st Column 0 2nd Column 0 3rd Column 0 4th Column StartFraction epsilon Subscript n Superscript 2 Baseline Over 1 minus ModifyingAbove h With caret Subscript n Baseline EndFraction EndMatrix

where ModifyingAbove h With caret Subscript t Baseline equals bold upper X Subscript t Baseline left-parenthesis bold upper X prime bold upper X right-parenthesis Superscript negative 1 Baseline bold upper X prime Subscript t.

The third solution, called the "jackknife," is to define

ModifyingAbove bold upper Omega With caret Subscript 3 Baseline equals Start 4 By 4 Matrix 1st Row 1st Column StartFraction epsilon 1 squared Over left-parenthesis 1 minus ModifyingAbove h With caret Subscript 1 Baseline right-parenthesis squared EndFraction 2nd Column 0 3rd Column 0 4th Column 0 2nd Row 1st Column 0 2nd Column StartFraction epsilon 2 squared Over left-parenthesis 1 minus ModifyingAbove h With caret Subscript 2 Baseline right-parenthesis squared EndFraction 3rd Column 0 4th Column 0 3rd Row 1st Column 0 2nd Column 0 3rd Column down-right-diagonal-ellipsis 4th Column 0 4th Row 1st Column 0 2nd Column 0 3rd Column 0 4th Column StartFraction epsilon Subscript n Superscript 2 Baseline Over left-parenthesis 1 minus ModifyingAbove h With caret Subscript upper T Baseline right-parenthesis squared EndFraction EndMatrix

MacKinnon and White (1985) investigated these three modified HCCMEs, including the original HCCME, based on finite-sample performance of pseudo-t statistics. The original HCCME performed the worst. The first modification performed better. The second modification performed even better than the first, and the third modification performed the best. They concluded that the original HCCME should never be used in finite sample estimation, and that the second and third modifications should be used over the first modification if the diagonals of ModifyingAbove bold upper Omega With caret are available.

Seemingly Unrelated Regression HCCME

Extending the discussion to systems of g equations, the HCCME for SUR estimation is

left-parenthesis bold upper X overTilde prime bold upper X overTilde right-parenthesis Superscript negative 1 Baseline bold upper X overTilde prime ModifyingAbove bold upper Omega With caret bold upper X overTilde left-parenthesis bold upper X overTilde prime bold upper X overTilde right-parenthesis Superscript negative 1

where bold upper X overTilde is a n g times k matrix with the first g rows representing the first observation, the next g rows representing the second observation, and so on. ModifyingAbove bold upper Omega With caret is now a n g times n g block diagonal matrix with typical block g times g

ModifyingAbove bold upper Omega With caret Subscript i Baseline equals Start 4 By 4 Matrix 1st Row 1st Column psi Subscript 1 comma i Baseline psi Subscript 1 comma i Baseline 2nd Column psi Subscript 1 comma i Baseline psi Subscript 2 comma i Baseline 3rd Column ellipsis 4th Column psi Subscript 1 comma i Baseline psi Subscript g comma i Baseline 2nd Row 1st Column psi Subscript 2 comma i Baseline psi Subscript 1 comma i Baseline 2nd Column psi Subscript 2 comma i Baseline psi Subscript 2 comma i Baseline 3rd Column ellipsis 4th Column psi Subscript 2 comma i Baseline psi Subscript g comma i Baseline 3rd Row 1st Column vertical-ellipsis 2nd Column vertical-ellipsis 3rd Column vertical-ellipsis 4th Column vertical-ellipsis 4th Row 1st Column psi Subscript g comma i Baseline psi Subscript 1 comma i Baseline 2nd Column psi Subscript g comma i Baseline psi Subscript 2 comma i Baseline 3rd Column ellipsis 4th Column psi Subscript g comma i Baseline psi Subscript g comma i EndMatrix

where

psi Subscript j comma i Baseline equals epsilon Subscript j comma i Baseline upper H upper C 0

or

psi Subscript j comma i Baseline equals StartRoot StartFraction n Over n minus d f EndFraction EndRoot epsilon Subscript j comma i Baseline upper H upper C 1

or

psi Subscript j comma i Baseline equals epsilon Subscript j comma i Baseline slash StartRoot 1 minus ModifyingAbove h With caret Subscript i Baseline EndRoot upper H upper C 2

or

psi Subscript j comma i Baseline equals epsilon Subscript j comma i Baseline slash left-parenthesis 1 minus ModifyingAbove h With caret Subscript i Baseline right-parenthesis upper H upper C 3
Two- and Three-Stage Least Squares HCCME

For two- and three-stage least squares, the HCCME for a g equation system is

normal upper C normal o normal v upper F left-parenthesis ModifyingAbove bold upper Omega With caret right-parenthesis normal upper C normal o normal v

where

normal upper C normal o normal v equals left-parenthesis StartFraction 1 Over n EndFraction bold upper X prime left-parenthesis bold upper I circled-times bold upper Z left-parenthesis bold upper Z prime bold upper Z right-parenthesis Superscript negative 1 Baseline bold upper Z prime right-parenthesis bold upper X right-parenthesis Superscript negative 1

is the normal covariance matrix without the bold upper S matrix and

upper F left-parenthesis bold upper Omega right-parenthesis equals StartFraction 1 Over n EndFraction sigma-summation Underscript i Overscript g Endscripts sigma-summation Underscript j Overscript g Endscripts bold upper X prime Subscript i Baseline bold upper Z left-parenthesis bold upper Z prime bold upper Z right-parenthesis Superscript negative 1 Baseline bold upper Z prime ModifyingAbove bold upper Omega With caret Subscript i j Baseline bold upper Z left-parenthesis bold upper Z prime bold upper Z right-parenthesis Superscript negative 1 Baseline bold upper Z prime bold upper X Subscript j

where bold upper X Subscript j is a n times p matrix with the jth equations regressors in the appropriate columns and zeros everywhere else.

ModifyingAbove bold upper Omega With caret Subscript i j Baseline equals Start 4 By 4 Matrix 1st Row 1st Column psi Subscript i comma 1 Baseline psi Subscript j comma 1 Baseline 2nd Column 0 3rd Column 0 4th Column 0 2nd Row 1st Column 0 2nd Column psi Subscript i comma 2 Baseline psi Subscript j comma 2 Baseline 3rd Column 0 4th Column 0 3rd Row 1st Column 0 2nd Column 0 3rd Column down-right-diagonal-ellipsis 4th Column 0 4th Row 1st Column 0 2nd Column 0 3rd Column 0 4th Column psi Subscript i comma n Baseline psi Subscript j comma n EndMatrix

For 2SLS ModifyingAbove bold upper Omega With caret Subscript i j Baseline equals 0 when i not-equals j. The epsilon Subscript t used in ModifyingAbove bold upper Omega With caret is computed by using the parameter estimates obtained from the instrumental variables estimation.

The leverage value for the ith equation used in the HCCME=2 and HCCME=3 methods is computed as conditional on the first stage as

h Subscript t i Baseline equals bold upper Z Subscript t Baseline left-parenthesis bold upper Z prime bold upper Z right-parenthesis Superscript negative 1 Baseline bold upper X Subscript i Baseline left-parenthesis bold upper X prime left-parenthesis bold upper I circled-times bold upper Z left-parenthesis bold upper Z prime asterisk bold upper Z right-parenthesis Superscript negative 1 Baseline bold upper Z prime right-parenthesis bold upper X right-parenthesis Superscript negative 1 Baseline bold upper X prime Subscript i Baseline bold upper Z left-parenthesis bold upper Z prime bold upper Z right-parenthesis Superscript negative 1 Baseline bold upper Z prime Subscript t

for 2SLS and

h Subscript t i Baseline equals bold upper Z Subscript t Baseline left-parenthesis bold upper Z prime bold upper Z right-parenthesis Superscript negative 1 Baseline bold upper X Subscript i Baseline left-parenthesis bold upper X prime left-parenthesis bold upper S Superscript negative 1 Baseline circled-times bold upper Z left-parenthesis bold upper Z prime asterisk bold upper Z right-parenthesis Superscript negative 1 Baseline bold upper Z prime right-parenthesis bold upper X right-parenthesis Superscript negative 1 Baseline bold upper X prime Subscript i Baseline bold upper Z left-parenthesis bold upper Z prime bold upper Z right-parenthesis Superscript negative 1 Baseline bold upper Z Subscript t Superscript prime Baseline slash bold upper S Subscript i i

for 3SLS.

Last updated: June 19, 2025