Reputation: 31
I am trying to estimate a spatial lag model with the package 'spdep' in R. I am using the function 'lagsarlm'. It seems that this function does not natively support regression weights (unlike for example 'errorsarlm' in the same package), and I wanted to know whether an alternative exists that does support regression weights.
To clarify, I have a data set with spatial units (counties) and aggregate variables at the county-level (electoral participation, and various sociodemographics). I want to predict electoral participation based on sociodemographics (all at the county-level), but accounting for the fact that participation in one county may affect participation in neighboring counties. Crucially, the regression should be weighted by the number of voters in each county.
By spatial lag model, I mean a model of the form: y=ρWy+Xβ+ε
With W a weighted matrix of distance across spatial units.
As I mentioned, 'lagsarlm' does not seem to accept regression weights. By contrast, 'errorsarlm' (for spatial error models) does accept a "weights" argument. Do you know why that is the case? And is there a way to estimate a weighted spatial lag model in R?
REPRODUCIBLE EXAMPLE
library(spdep)
example(columbus)
listw <- nb2listw(col.gal.nb)
# A random vector of positive weights (e.g. population of spatial units)
myweights <- rnorm(nrow(columbus), mean = 1000, sd = 100)
summary(myweights)
# normal spatial lag model and spatial error model
slag <- lagsarlm(CRIME ~ INC + HOVAL, columbus, listw)
serror <- errorsarlm(CRIME ~ INC + HOVAL, columbus, listw)
summary(slag)
summary(serror)
# Weighted versions:
w_slag <- lagsarlm(CRIME ~ INC + HOVAL, columbus, listw, weights = myweights) # does not work here
w_serror <- errorsarlm(CRIME ~ INC + HOVAL, columbus, listw,weights = myweights)
summary(w_slag)
summary(w_serror)
Upvotes: 3
Views: 36