[R-sig-Geo] Measures of dispersion and statistical significance of the impacts of a panel Spatial Durbin model (SDM)
Alain N'Ghauran
ngh@ur@n @end|ng |rom g@te@cnr@@|r
Fri Apr 19 11:51:29 CEST 2019
Hello, group
I ran a panel Spatial Durbin model (SDM) and computed the summary
measures of impacts (direct, indirect and total). Now, I would like to
get measures of dispersion for the impacts estimates as well as the
statistical significance of the impacts.
How can I get such measures ?
Here is a reproducible example:
################################################################################
################################################################################
set.seed(1234)
library(plm)
library(splm)
data(Produc, package = "plm")
data(usaww)
# Create spatially lagged independent variables WX using slag()
Produc2 <- pdata.frame(Produc, index = c("state", "year"))
Produc2$pcap_SL <- slag(log(Produc2$pcap), mat2listw(usaww))
Produc2$pc_SL <- slag(log(Produc2$pc), mat2listw(usaww))
Produc2$emp_SL <- slag(log(Produc2$emp), mat2listw(usaww))
Produc2$unemp_SL <- slag(log(Produc2$unemp), mat2listw(usaww))
# Define formula
fm <- log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp +
pcap_SL + pc_SL + emp_SL + unemp_SL
# Spatial Durbin Model : Y = ρ.WY + β.X + θ.WX + μ
summary(
sdm <- spml(fm, data = Produc2, index = c("dep", "period"),
model = "within", effect = "twoways", lag = TRUE,
listw = mat2listw(usaww), spatial.error = "none",
LeeYu = TRUE, Hess = FALSE)
)
## Compute impact measures of variable pcap (thanks to Prof Bivand)
# Impacts are computed using equation (25) in LeSage (2008)
# LeSage (2008) is available at
https://journals.openedition.org/rei/pdf/3887
# Note that I cannot use impacts.splm() since the current development of
splm doesn’t allow impacts on SDM
Time <- length(unique(Produc$year))
N <- length(unique(Produc$state))
library(Matrix)
s.lws <- kronecker(Diagonal(Time) , listw2dgCMatrix(mat2listw(usaww)))
IrW <- Diagonal(N * Time) - sdm$spat.coef * s.lws
IrWi <- solve(IrW)
S_pcap <- IrWi * (Diagonal(N * Time) * sdm$coefficients[2] +
s.lws * sdm$coefficients[6])
# direct impact
dir_imp <- mean(diag(S_pcap))
# total impact
tot_imp <- mean(rowSums(S_pcap)) # or sum(S_pcap)/816
# indirect impact : total impact - direct impact
indir_imp <- tot_imp - dir_imp
# LeSage (2008) provides guidance for drawing inference regarding the
significance
# of these impacts (section 4.2, page 35) but I'm struggling to
implement it in R.
# Could you help me deal with this ?
################################################################################
################################################################################
Thanks,
Alain
More information about the R-sig-Geo
mailing list