I have a panel dataset with several hundred regions, ~10 years and spatial data for the regions. I created a weight matrix with the spdep
package (via the standard way, and then, nb2listw
).
I have, thus, a matrix with weights for each region (in relation to the other regions) - but each region is represented just once.
I would like to run some of the spatial regressions from the spdep
package (lagsarlm
, errorsarlm
), but I get an error:
Error in subset.listw(listw, subset, zero.policy = zero.policy) :
Not yet able to subset general weights lists
and
Error in lagsarlm(y ~ x1 + x2: Input data and weights have different dimensions
I assume this is because the weight matrix has only one row per region (and then, only one year can be calculated). Do you have any suggestions how to attack the issue? My ideas revolve around the following:
- Extend the spatial weight matrix OR
- Tell spdep that the regions will repeat in the same order (but how?)
Looking forward to your suggestions.