[R-sig-Geo] Predict leads to 'non-conformable arguments'

Roger Bivand Roger.Bivand at nhh.no
Wed Mar 14 07:37:56 CET 2012


On Tue, 13 Mar 2012, Smit, M.J. wrote:

> Dear list,
>
> I'm trying to do a scenario analysis by changing a few values in the 
> dataset, and running 'predict' from spdep both before and after. 
> However, I get 'non-comformable arguments', even when I just add the old 
> dataset as 'newdata='. What is happening?

Please do provide reproducible cases. This isn't, as you neither use built 
in data, nor a link to your own data.

Also always name arguments to functions as this disambiguates the calls, 
and avoids helpers having to look the arguments up.

Roger

>
> My lagsarlm runs fine; so does the first prediction ("pred1"). It is the second one that fails.
> A sample of my code:
> dat2 <- data.frame(NUTS_ID,COUNTRY,SPEND,<and 20 other variables> )
> wgdist2 <- mat2listw(matgdist,dat2$NUTS_ID)
> durbland <- lagsarlm(form_land,dat2,wgdist2,type="mixed")
> summary(durbland)
> pred1 <- predict(durbland,NULL,wgdist2,zero.policy=TRUE)
> pred2 <- predict(durbland,dat2,wgdist2,zero.policy=TRUE) # Note this fails, although the data is identical.
>
> ... and the last command always gets me
> Error in X %*% B : non-conformable arguments
>
> even before I get to executing
> dat2$SPEND[dat2$COUNTRY=="PL"] <- dat2$SPEND[dat2$COUNTRY=="PL"]*2
>
> Best regards,
> Martijn
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
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