Examining and Correcting for Heteroskedasticity using Stata
Heteroskedasticity is frequently encountered in regression analysis. It is something that we need to routinely examine for in each model we run, since it's presence will produce results that lead us to make erroneous inferences with our hypothesis tests.
We will use the State Crimel data set for this analysis. StateCrime2.dta
The steps we will follow will be:
Run the regression analysis
Using the state crime data regress the crime rate on the employment and urbanization rates.
regress rate96 urb96 emprat96
Note that heteroskedasticity is not apparent based on anything displayed in the analysis. We therefore need to test for it.
Test for heteroskedasticity
Testing for heteroskedasticity in Stata is quite easy. Use the following command directly after the regression run.
Run the regression model with robust standard errors
regress rate96 urb96 emprat96, r
Examine the residuals
Save the residuals with
predict res, r
The plot the residuals by the dependent variable
plot res rate96
Find a creative solution