[R-sig-Geo] Measures of dispersion and statistical significance of the impacts of a panel Spatial Durbin model (SDM)
Roger Bivand
Roger@B|v@nd @end|ng |rom nhh@no
Sun Apr 21 19:22:42 CEST 2019
On Fri, 19 Apr 2019, Alain N'Ghauran wrote:
> 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 ?
I think that during the next few years, someone may implement this, but it
is far from simple. If you have the time and energy, you'd need to set up
input for spatialreg::intImpacts(), which would then sample from the
fitted model and calculate the impacts on those samples to give an
inferential basis. It will be easier to add a Durbin= argument to splm
fitting functions, but this needs to wait until spatialreg exposes a
single portable function handling the argument. For the present time, your
only option is S_r(W) and no inference. Consider making an issue in
spatialreg on github with regard to a Durbin= argument handling function,
but I do not anticipate being able to do that this year without
contributions from others.
Roger
>
> ################################################################################
> ################################################################################
>
> Thanks,
>
> Alain
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: Roger.Bivand using nhh.no
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
More information about the R-sig-Geo
mailing list