A Hands on Tutorial | 您所在的位置:网站首页 › statasumm › A Hands on Tutorial |
An important assumption of the classical linear regression model is that the variance in the residuals has to be homoskedastic or constant. Graphical way to check homoskedasticity When plotting residuals vs. predicted values (Yhat), we should not observe any pattern at all. In Stata, we do this using rvfplot right after running the regression, it will automatically draw a scatter plot between residuals and predicted values. Type: regress csat expense percent income high college i.region rvfplot, yline(0) rvfplot, yline(0)Residuals seem to expand slightly at higher levels of Yhat. A non-graphical way to detect heteroskedasticity is the Breusch-Pagan test. The null hypothesis is that residuals are homoskedastic. In the example below, we reject the null at 95% level and conclude that residuals are heteroscedastic. Breusch-Pagan / Cook-Weisberg test for heteroskedasticity Ho: Constant variance Variables: fitted values of csat chi2(1) = 1.40 Prob > chi2 = 0.2375The graphical and the Breush-Pagan test suggest the possible presence of heteroskedasticity in our model. The problem with this is that we may have the wrong estimates of the standard errors for the coefficients and, therefore their t-values. There are two ways to deal with this problem; one is using heteroskedasticity-robust standard errors, and the other one is using weighted least squares (see Stock and Watson, 2003, chapter 15). WLS requires knowledge of the conditional variance on which the weights are based; if this is known (rarely the case), then use WLS. In practice, it is recommended to use heteroskedasticity-robust standard errors to deal with heteroskedasticity. By default Stata assumes homoskedastic standard errors, so we need to adjust our model to account for heteroskedasticity. To do this, we use the option robust in the regress command. For example, regress csat expense percent income high college i.region, robust Note: Stock and Watson (2019, chapter 5) suggest, as a rule of thumb, we should always assume heteroskedasticity in our model and therefore run robust regression. |
CopyRight 2018-2019 实验室设备网 版权所有 |