[R] Contradictory results between different heteroskedasticity tests
Carlos Pita
carlosjosepita at gmail.com
Tue Sep 18 20:21:32 CEST 2012
Hi all,
I'm getting contradictory results from bptest and ncvTest on a model
calculated by GLS as:
olslm = lm(log(rr)~log(aloi)*reg*inv, data)
varlm = lm(I(residuals(olslm)^2)~log(aloi)*reg*inv, data)
glslm = lm(log(rr)~log(aloi)*reg*inv, data, weights=1/fitted(varlm))
Testing both olslm and glslm with both ncvTest and bptest gives:
> ncvTest(olslm)
Non-constant Variance Score Test
Variance formula: ~ fitted.values
Chisquare = 46.88206 Df = 1 p = 7.538963e-12
> ncvTest(glslm)
Non-constant Variance Score Test
Variance formula: ~ fitted.values
Chisquare = 0.001466426 Df = 1 p = 0.9694533
> bptest(olslm)
studentized Breusch-Pagan test
data: olslm
BP = 213.1477, df = 7, p-value < 2.2e-16
> bptest(glslm)
studentized Breusch-Pagan test
data: glslm
BP = 213.1477, df = 7, p-value < 2.2e-16
Please notice the last output. It seems as if bptest is not
considering the weights given to lm. What am I doing wrong here?
Best regards
--
Carlos
More information about the R-help
mailing list