[R-sig-Geo] error using predict.sarlm
evans324 at umn.edu
evans324 at umn.edu
Wed Apr 22 16:35:18 CEST 2009
I am encountering difficulties using predict.sarlm to make predictions for
a SAR lag model generated using lagsarlm and a new dataset. I used the
following code to do so:
dak_test.10nn.predict <- predict.sarlm(reg_vars_reduced2.10nn.lag, newdata
= "dak_test_data", listw = dak_test.10nn.listw, zero.policy = TRUE)
When I run this, I get the following error message: "Error in if
(nrow(newdata) != length(listw$neighbours)) stop("mismatch between newdata
and spatial weights") : argument is of length zero"
I recognize that there is a problem with my listw object, but am not sure
how to handle it. I produced the listw using the following code sequence:
dak_test.10nn <- knearneigh(coords, k=10)
dak_test.10nn.nb <- knn2nb(dak_test.10nn, row.names=rn, sym=TRUE)
dak_test.10nn.listw <- nb2listw(dak_test.10nn.nb, zero.policy=TRUE)
Can anyone offer me some guidance in solving this problem? Thanks for your
help.
Heather Sander
--
Heather Sander
Ph.D. Candidate: Conservation Biology
Office: 305 Ecology & 420 Blegen
Mail:
University of Minnesota
Dept. of Geography
414 Social Science Bldg.
267 19th Ave. S.
Minneapolis, MN 55455
USA
More information about the R-sig-Geo
mailing list