November 2014
M T W T F S S
« May    
 12
3456789
10111213141516
17181920212223
24252627282930

Heteroscedasticity

If a model is estimated using the following code:
lm(y~x1+x2)->p

1. bptest(p) does the Breuch Pagan test to formally check presence of heteroscedasticity. To use bptest, you will have to call lmtest library.

2. If the test is positive (low p value), you should see if any transformation of the dependent variable helps you eliminate heteroscedasticity. Also check if the right hand side of the model is okay.

3. If 2 does not work, you can use the white’s heteroscedasticity-corrected covariance matrices to make inference. Package car has a function hccm that gives you the heteroscedasticity-corrected covariance matrix (there is a similar function in package sandwich also). coeftest(p,vcov=hccm(p)) will give you the results of the tests using this matrix. Use these results instead of summary(p).

library(lmtest)
library(car)
bptest(p)
coeftest(p,vcov=hccm(p))

Tags:

Comments are closed.