How to Perform a Breusch-Pagan Test in SAS

A Breusch-Pagan Test is used to determine if heteroscedasticity 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;
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

/*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;

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

If you fail to reject the null hypothesis of the Breusch-Pagan test, then heteroscedasticity is not present and you can proceed to interpret the output of the original regression.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *