Good evening, I'm trying to use "impacts" from package spdep, to get the impacts of unit changes in the independent variables, based on a fitted "lagsarlm" model. However, I'm running into two problems:
First, when I call "impacts", I get an error message that my weights are not row-standardised, when in fact they are. I can deal with this problem by coercing obj$listw_style to "W", but I'm wondering why this is happening at all. Second, when I try to run simulations to generate estimates of the uncertainties for the estimates of the impacts, "impacts" seems not to acknowledge "R", and simply returns the estimates without any uncertainty. Can anyone tell me what I'm doing wrong (i.e., how I can get a series of simulations instead)? The code I'm using is below. Many thanks in advance for any assistance. - Malcolm > oxw <- oxw/apply(oxw, 1, sum) # this is the weights matrix > table(apply(oxw, 1, sum)==1, useNA="always") # confirming rows sum to 1 TRUE <NA> 48 0 > oxw.listw <- mat2listw(as.matrix(oxw)) # seems OK > lagmod <- lagsarlm(ben95 ~ rskpovpc +wage95 + instcoad + ipcfold + teitrend + > match, data=ox, listw=oxw.listw, method="eigen", tol.solve=1.0e-11) # seems OK > impacts(lagmod, listw=oxw.listw) Error in impacts.sarlm(lagmod, listw = oxw.listw) : Only row-standardised weights supported > lagmod$listw_style <- "W" # coercing to a different "style" > impacts(lagmod, listw=oxw.listw) # results make sense Impact measures (lag, exact): Direct Indirect Total rskpovpc 3.953047 3.81574967 7.76879705 wage95 -0.027922 -0.02695221 -0.05487421 instcoad 1.566704 1.51228867 3.07899227 ipcfold 487.134198 470.21499459 957.34919259 teitrend 2.654201 2.56201450 5.21621501 match -5.894235 -5.68951544 -11.58375015 > impacts(lagmod, R=100, listw=oxw.listw) # doesn't run sims... Impact measures (lag, exact): Direct Indirect Total rskpovpc 3.953047 3.81574967 7.76879705 wage95 -0.027922 -0.02695221 -0.05487421 instcoad 1.566704 1.51228867 3.07899227 ipcfold 487.134198 470.21499459 957.34919259 teitrend 2.654201 2.56201450 5.21621501 match -5.894235 -5.68951544 -11.58375015 _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo