[R-sig-Geo] [r-sig-geo] Please help to solve error of spml model in SPLM of R

Roger Bivand Roger.Bivand at nhh.no
Tue Sep 25 09:33:45 CEST 2012


On Tue, 25 Sep 2012, gum hwang wrote:

> Howdy, Grus
>
> If this message is overlapped, please forgive me.
>
> I have some troubles with SPLM package of R.
> I am trying to estimate some parameters and their model using SPML in SPLM
> package of R.
> Could you tell me some tips to solve my problem below ?

Try:

lm(fm.2, data = mega.data, na.action=na.fail)

and see if you get the same error. It looks as though there are different 
numbers of observations on some variables. Also always run traceback() 
after any error you do not understand, to see the calling sequence of 
functions. Here model.frame.default() was the failing function, which is 
also called in lm(), hence my suggestion. It is also possible that you 
have multiple objects called Census, say both in the global environment 
and in mega.data.

Hope this clarifies,

Roger


>
> --------------------------------------------------------------------------------------------------------------------------------------------------------
> ...
> fm.2 <- mr2.tent ~ Census + Den + CmtSch + CmtPop + SchPop + StayPop +
> DayPop
>     + firm + firm500 + RegWrk + GrsWrk + MnfFirm + MnfReg+ MnfGrs
> ...
>> fespaterr <- spml(fm.2, data = mega.data, listw = mat2listw(megaww),
> model="within", spatial.error="b")
> Error in model.frame.default(object, data, xlev = xlev) :
>  variable lengths differ (found for 'Census')
>>
>
> For variaable reference,
> Y variable is mr2.tent.
> X variables are population and firm workers.
> Population is Census, Den, CmtSch, CmtPop, SchPop, StayPop,  DayPop.
> Firms are  firm and firm500.
> Firm workers are RegWrk, GrsWrk, MnfFirm, MnfReg,  MnfGrs.
> ----------------------------------------------------------------------------------------------------------------------------------------------------------
>
> I appreciate in advance,
>
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list