error using predict.sarlm
Hi Roger,
Then the dak_test_data is a SpatialPolygonsDataFrame, for which there is no nrow() method, leading to problems. Please get around this by saying newdata=as(dak_test_data, "data.frame") to coerce it to data frame. I'll look at providing dim methods for Spatial*DataFrame objects other than SpatialPointsDataFrame, which are in sp already; nrow() just returns dim()[1] of the object.
Thanks for your help so far. I tried your suggestion using the following code: dak_test_vars.10nn.predict <- predict.sarlm(reg_vars_formula.lag, newdata=as(dak_test_vars, "data.frame"), listw = dak_test.10nn.listw,zero.policy=TRUE) Now I get a new error message: "Error in invIrW(listw, object$rho) %*% trend : non-conformable arguments". I double checked the listw object and data frame properties. They are as follows: nrow(as(dak_test_vars, "data.frame") = 2255 length(dak_test.10nn.listw) [1] 3 names(dak_test.10nn.listw) [1] "style" "neighbours" "weights" length(dak_test.10nn.listw[[2]]) [1] 2255 length(coords_test) [1] 4510 I am unsure of how to interpret this error. Do you have any advice? Thanks for your help. Heather
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