[R] an object of class lm returned by lm?

Roger Bivand Roger.Bivand at nhh.no
Sun Nov 16 12:30:06 CET 2003


On Sat, 15 Nov 2003, Jill Caviglia-Harris wrote:

> Duncan:
> 
> Thanks for your response.  I actually tried this as well.  The error
> message I get is "objects of different length" I thought I was chosign
> the model incorrectly, perhaps this is something else?
> 

The error message is caused by a difference in the length of the residual 
vector - see 

> length(rediduals(model))

and the number of spatial units in your spatial weights list object, see

> length(listw$neighbours)

or

> print(listw)

Please contact me off-list if you need more explanation, for example 
giving the output of these lengths.

Roger


> -Jill
> 
> ***************************************************
> Jill L. Caviglia-Harris, Ph.D.
> Assistant Professor
> Economics and Finance Department
> Salisbury University
> Salisbury, MD 21801-6860
>    phone: (410) 548-5591
>    fax: (410) 546-6208
> *********************************************************
> 
> >>> Duncan Murdoch <dmurdoch at pair.com> 11/15/03 08:00PM >>>
> On Sat, 15 Nov 2003 19:41:29 -0500, you wrote:
> 
> >Can someone tell me what an object of class lm returned by lm means? 
> I
> >assumed it mean the regression model - but I'm not sure how to enter
> >this in.  I have tried 
> >
> >y~a+b 
> >
> >but this is not working.  I have also tried saving the regression
> >results and entering these, but again this is incorrect.  
> >
> >This language is from the following:
> >
> >lm.LMtests(model, listw, zero.policy=FALSE, test="LMerr", spChk=NULL)
> >
> >Arguments
> >model - an object of class lm returned by lm
> >listw - a listw object created for example by nb2listw, expected to
> be
> >row-standardised (W-style) 
> >
> >
> >Any help is welcomed.  Thanks.
> 
> Most functions in R return objects.  The description of "model" is
> referring to the object returned by the lm() function.  For example,
> 
> fit <- lm(y~a+b)
> 
> Then "fit" would be a suitable value to pass as the model.
> 
> Duncan Murdoch
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no




More information about the R-help mailing list