[R-sig-Geo] Error object 'can.sim2' not found in spatianl panel data - splm with spdep
Patrick Meyfroidt
Patrick.Meyfroidt at uclouvain.be
Mon Oct 8 13:47:20 CEST 2012
OK, I may have some update, sorry for the disturbance.
By explicitly indicating that listw2 is the same as listw, like that:
spml(formula = fm, data = rusp9508.subsvars, index ="index", listw =
wrus.knb5, listw2 = listw, model = "within", lag = TRUE, spatial.error =
"b")
I now get the following error message:
Error in match(x, table, nomatch = 0L) : object 'listw' not found
So apparently the listw object cannot be read.
Is it because the weights were calculated once for each country, but the
dataset is a panel one?
Does someone have a clue?
Thanks,
Patrick Meyfroidt
> Dear list,
>
> I have spatial panel data (regions over years), that I subsetted to make
> sure that the panel is balanced.
>
> Using spdep, I calculated weights using nearest neighbors on these
> regions, with the following code:
>
> --
> RUSCRS <- CRS("+proj=lcc +lat_1=15 +lat_2=65 +lat_0=30 +lon_0=95 +x_0=0
> +y_0=0 +units=m +datum=WGS84")
> rus <- readShapeSpatial([filename], IDvar = "index", proj4string = RUSCRS)
> coords <- coordinates(rus)
> ruskn5 <- knearneigh(coords, k=5, longlat = NULL)
> ruskn5.nb <- knn2nb(ruskn5, row.names=rus$index, sym = FALSE)
> wrus.knb5 <- nb2listw(ruskn5.nb, glist=NULL, style="W", zero.policy=NULL)
> --
>
> Everything looks fine, i.e. I can print out the results at each step, and
> each unit apparently has indeed 5 neighbors with 0.2 weight for each.
>
> Then I use splm package to perform a spatial panel regression, using the
> code:
>
> --
> fm <- rnabd ~ rlex + pbpl
> spml(formula = fm, data = rusp9508.subsvars, index ="index", listw =
> wrus.knb5, model = "within", lag = TRUE, spatial.error = "b")
> --
>
> But I end up with the following error message:
>
> "Error in get("can.sim2", envir = env) : object 'can.sim2' not found"
>
>
> Can someone explain what is this "can.sim2" object and possible reasons
> for the error message?
>
> Thank you very much for any input,
>
> Patrick Meyfroidt
> Université catholique de Louvain - Belgium
>
More information about the R-sig-Geo
mailing list