I am using a spatial lag and durbin regression models and I would like to estimate the standard errors of the impacts. Any ideas on how to do this?
# data
data(oldcol)
# neighbours lists
lw <- nb2listw(COL.nb, style="W")
# regression
fit_durb <- lagsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, type="Durbin",
listw=lw, method="eigen",
zero.policy=T, na.action="na.omit")
# power traces
W <- as(lw, "CsparseMatrix")
trMC <- trW(W, type="MC", listw = lw)
# Impacts
imp <- summary(impacts(fit_durb, tr=trMC, R=1000), zstats=TRUE, short=TRUE)
You should be able to use the MC samples stored in the imp object to get the standard errors, for instance:
test1<-lapply(imp$sres, function(x){apply(x, 2, mean)})
test2<-lapply(imp$sres, function(x){apply(x, 2, sd)}
test1$direct/test2$direct
give the same z values as returned by imp