-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Carlos Pita
Sent: Tuesday, September 18, 2012 2:22 PM
To: r-help at r-project.org
Subject: [R] Contradictory results between different heteroskedasticity
tests
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:
Non-constant Variance Score Test
Variance formula: ~ fitted.values
Chisquare = 46.88206 Df = 1 p = 7.538963e-12
Non-constant Variance Score Test
Variance formula: ~ fitted.values
Chisquare = 0.001466426 Df = 1 p = 0.9694533
studentized Breusch-Pagan test
data: olslm
BP = 213.1477, df = 7, p-value < 2.2e-16
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