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

Smit, M.J. martijn.smit at vu.nl
Tue Mar 13 17:24:07 CET 2012

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?

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")
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, 

More information about the R-sig-Geo mailing list