How do I perform a Breusch-Pagan Test in SAS?

The Breusch-Pagan Test is a statistical test used to assess the presence of heteroscedasticity in a linear regression model. To perform this test in SAS, one must first use the REG procedure to fit the linear regression model. Then, the MODEL statement must be used to specify the model for the Breusch-Pagan test and the TEST statement should be used to request the Breusch-Pagan test. The output from this test can then be used to determine the presence of heteroscedasticity.


A is used to determine if is present in a regression analysis.

This tutorial explains how to perform a Breusch-Pagan Test in SAS.

Example: Breusch-Pagan Test in SAS

Suppose we want to fit a multiple linear regression model that uses number of hours spent studying and number of prep exams taken to predict the final exam score of students:

Exam Score = β0 + β1(hours) +β2(prep exams)

First, we’ll use the following code to create a dataset that contains this information for 20 students:

/*create dataset*/
data exam_data;
    input hours prep_exams score;
    datalines;
1 1 76
2 3 78
2 3 85
4 5 88
2 2 72
1 2 69
5 1 94
4 1 94
2 0 88
4 3 92
4 4 90
3 3 75
6 2 90
5 4 90
3 4 82
4 4 85
6 5 90
2 1 83
1 0 62
2 1 76
;
run;

/*view dataset*/
proc print data=exam_data;

Next, we’ll use proc model to fit this multiple linear regression model along with the pagan statement to perform the Breusch-Pagan test for heteroscedasticity:

/*fit regression model and perform Breusch Pagan test*/
proc model data=exam_data;
    parms a1 b1 b2;
    score = a1 + b1*hours + b2*prep_exams;
    fit score / pagan=(1 hours prep_exams)
    out=resid1 outresid;
run;
quit;

Breusch-Pagan test in SAS

The last table in the output shows the results of the Breusch-Pagan test.

From this table we can see that the test statistic is 5.05 and the corresponding p-value is 0.0803.

Since the p-value is not less than 0.05, we fail to reject the null hypothesis.

This means we do not have sufficient evidence to say that heteroscedasticity is present in the regression model.

Thus, it’s safe to interpret the standard errors of the coefficient estimates in the regression summary table.

What To Do Next

However, if you reject the null hypothesis, this means heteroscedasticity is present in the data. In this case, the standard errors that are shown in the output table of the regression may be unreliable.

There are a couple common ways that you can fix this issue, including:

1. Transform the response variable. You can try performing a transformation on the response variable.

For example, you could use the log of the response variable instead of the original response variable.

Typically taking the log of the response variable is an effective way of making heteroscedasticity go away.

Another common transformation is to use the square root of the response variable.

2. Use weighted regression. This type of regression assigns a weight to each data point based on the variance of its fitted value.

This gives small weights to data points that have higher variances, which shrinks their squared residuals.

When the proper weights are used, this can eliminate the problem of heteroscedasticity.

x