**White’s test** is used to determine if heteroscedasticity is present in a regression model.

Heteroscedasticity refers to the unequal scatter of residuals at different levels of a response variable in a regression model, which violates one of the key assumptions of linear regression that the residuals are equally scattered at each level of the response variable.

This tutorial explains how to perform White’s test in SAS to determine whether or not heteroscedasticity is a problem in a given regression model.

**Example: White’s 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 reg **to fit this multiple linear regression model along with the **spec **option to perform White’s test test for heteroscedasticity:

**/*fit regression model and perform White's test*/
proc reg data=exam_data;
model score = hours prep_exams / spec;
run;
quit;**

The last table in the output shows the results of White’s test.

From this table we can see that the Chi-Square test statistic is **3.54 **and the corresponding p-value is **0.6175**.

White’s test uses the following null and alternative hypotheses:

**Null (H**: Heteroscedasticity is not present._{0})**Alternative (H**Heteroscedasticity is present._{A}):

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 White’s 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.