[R] Test for Homoscedesticity in R Without BP Test
Achim Zeileis
Achim.Zeileis at uibk.ac.at
Mon Apr 4 21:28:00 CEST 2016
On Mon, 4 Apr 2016, varin sacha via R-help wrote:
> Hi Deepak,
>
> In econometrics there is another test very often used : the white test.
> The white test is based on the comparison of the estimated variances of
> residuals when the model is estimated by OLS under the assumption of
> homoscedasticity and when the model is estimated by OLS under the
> assumption of heteroscedastic.
The White test is a special case of the Breusch-Pagan test using a
particular specification of the auxiliary regressors: namely all
regressors, their squares and their cross-products. As this specification
makes only sense if all regressors are continuous, many implementations
have problems if there are already dummy variables, interactions, etc. in
the regressor matrix. This is also the reason why bptest() from "lmtest"
uses a different specification by default. However, you can utilize the
function to carry out the White test as illustrated in:
example("CigarettesB", package = "AER")
(Of course, the AER package needs to be installed first.)
> The White test with R
>
> install.packages("bstats")
> library(bstats)
> white.test(LinearModel)
That package is no longer on CRAN as it took the code from bptest()
without crediting its original authors and released it in a package that
conflicted with the original license. Also, the implementation did not
check for potential problems with dummy variables or interactions
mentioned above.
So the bptest() implementation from "lmtest" is really recommend. Or
alternatively ncvTest() from package "car".
> Hope this helps.
>
> Sacha
>
>
>
>
>
> ________________________________
> De : Deepak Singh <sdeepakrhelp at gmail.com>
> À : r-help at r-project.org
> Envoyé le : Lundi 4 avril 2016 10h40
> Objet : [R] Test for Homoscedesticity in R Without BP Test
>
>
> Respected Sir,
> I am doing a project on multiple linear model fitting and in that project I
> have to test Homoscedesticity of errors I have google for the same and
> found bptest for the same but in R version 3.2.4 bp test is not available.
> So please suggest me a test on homoscedesticity ASAP as we have to submit
> our report on 7-04-2016.
>
> P.S. : I have plotted residuals against fitted values and it is less or
> more random.
>
> Thank You !
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list