The first argument of the coeftest function contains the output of the lm function and calculates the t test based on the variance-covariance matrix provided in the vcov argument. In R the function coeftest from the lmtest package can be used in combination with the function vcovHC from the sandwich package to do this. Since we already know that the model above suffers from heteroskedasticity, we want to obtain heteroskedasticity robust standard errors and their corresponding t values. Fortunately, the calculation of robust standard errors can help to mitigate this problem. Since standard model testing methods rely on the assumption that there is no correlation between the independent variables and the variance of the dependent variable, the usual standard errors are not very reliable in the presence of heteroskedasticity. This is an example of heteroskedasticity. This means that there is higher uncertainty about the estimated relationship between the two variables at higher income levels. However, as income increases, the differences between the observations and the regression line become larger. The regression line in the graph shows a clear positive relationship between saving and income. Labs(x = "Annual income", y = "Annual savings") # Only use positive values of saving, which are smaller than income The dataset is contained the wooldridge package. A popular illustration of heteroskedasticity is the relationship between saving and income, which is shown in the following graph.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |