[R-sig-Geo] impacts in spdep does not work for me when there is only one predictor

Roger Bivand Roger.Bivand at nhh.no
Tue Sep 28 21:47:07 CEST 2010


On Tue, 28 Sep 2010, Eelke Folmer wrote:

> Dear Roger and others,
>
> Using the impacts function in spdep to calculate distributions (on the 
> regression parameters from the spatial lag model) I encountered the following 
> problem: when there is only one exogenous predictor in the model the impacts 
> function won't give the output summary of the mcmc simulations. Given the 
> time the function takes to produce the error I think that the simulations do 
> run.

Thanks for a clear report and reproducible example. I'll confirm when a 
fix has been committed to R-forge - it is caused ny matrix dimensions 
being dropped when there is only one row or column in some settings.

Best wishes,

Roger

>
> I tried the same on the columbus data where it also happens
>
> example(columbus)
> listw <- nb2listw(col.gal.nb)
> lobj  <- lagsarlm(CRIME ~ INC, columbus, listw)
> summary(lobj)
> imp   <- impacts(lobj, listw=birds.wlist, R=100)
> summary(imp,  zstats=TRUE)
>
> Error in dimnames(x) <- dn :
>  length of 'dimnames' [2] not equal to array extent
>
> lobj  <- lagsarlm(CRIME ~ INC + HOVAL, columbus, listw)
> summary(lobj)
> imp   <- impacts(lobj, listw=birds.wlist, R=100)
> summary(imp,  zstats=TRUE)
>
> works fine.
>
> I hope I didn't miss anything obvious.
> Thanks in advance,
> Eelke
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, 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