[R] bptest

Andrew Miles rstuff.miles at gmail.com
Sat Sep 25 02:19:59 CEST 2010


First load the package lmtest.  Then run the bptest.

library(lmtest)
bptest(modelCH)

You don't need to tell the function which variables are explanatory or  
dependent.  Just give it the fitted model object, and it will sort all  
of that out and return the statistic.

Andrew Miles
Department of Sociology
Duke University

On Sep 24, 2010, at 9:53 AM, robm wrote:

>
> Hi
>
> I'm very new to R but have plenty of experience with statistics and  
> other
> packages like SPSS, SAS etc.
>
> I have a dataset of around 20 columns and 200 rows.   I'm trying to  
> fit a
> very simple linear model between two variables.   Having done so, I  
> want to
> test the model for heteroscedasticity using the Breusch-Pagan test.
> Apparently this is easy in R by simply doing
>
> bptest(modelCH, data=KP)
>
> I've tried this but I'm told it cannot find function bptest.   It's  
> here
> where I'm struggling.   I'm probably wrong but as far as I can see,  
> bptest
> is part of the lm package which, as far as I know, I have installed.
>
> Irrespective of the fact I'm not sure how to tell bptest which is the
> dependent and explanatory variables - there's a more fundamental  
> problem if
> it can't find the bptest function.
>
> I have searched the documentation - albeit briefly so if anyone  
> could help
> I'd be very grateful
>
> Rob
>
> QBE Management
> -- 
> View this message in context: http://r.789695.n4.nabble.com/bptest-tp2553506p2553506.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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