impacts.stsls_sphet | R Documentation |
Generate impacts for objects of class lag_gmm created in sphet
## S3 method for class 'stsls_sphet'
impacts(
obj,
...,
tr = NULL,
R = NULL,
listw = NULL,
evalues = NULL,
tol = 1e-06,
empirical = FALSE,
Q = NULL,
KPformula = FALSE,
prt = TRUE
)
obj |
A spreg spatial regression object created by |
... |
Arguments passed through to methods in the coda package |
tr |
A vector of traces of powers of the spatial weights matrix created using |
R |
If given, simulations are used to compute distributions for the impact measures, returned as |
listw |
a listw object |
evalues |
vector of eigenvalues of spatial weights matrix for impacts calculations |
tol |
Argument passed to |
empirical |
Argument passed to |
Q |
default NULL, else an integer number of cumulative power series impacts to calculate if |
KPformula |
default FALSE, else inference of the impacts based on Kelejian and Piras (2020) |
prt |
prints the KP summary of the VC matrix |
Estimate of the Average Total, Average Direct, and Average Indirect Effects
Roger Bivand, Gianfranco Piras (2015). Comparing Implementations of Estimation Methods for Spatial Econometrics. Journal of Statistical Software, 63(18), 1-36. https://www.jstatsoft.org/v63/i18/. Harry Kelejian, Gianfranco Piras (2020). Spillover effects in spatial models: Generalization and extensions. Journal of Regional Science, 60(3), 425-442. Gianfranco Piras, Paolo Postiglione (2022). A deeper look at impacts in spatial Durbin model with sphet. Geographical Analysis, 54(3), 664-684.
require("sf", quietly=TRUE)
library(coda)
columbus <- st_read(system.file("shapes/columbus.gpkg", package="spData")[1], quiet=TRUE)
col.gal.nb <- spdep::read.gal(system.file("weights/columbus.gal", package="spData")[1])
listw <- spdep::nb2listw(col.gal.nb)
ev <- spatialreg::eigenw(listw)
W <- as(listw, "CsparseMatrix")
trMatc <- spatialreg::trW(W, type="mult")
trMC <- spatialreg::trW(W, type="MC")
#LAG
lobj_gm <- spreg(CRIME ~ INC + HOVAL, columbus, listw,
model = "lag")
summary(lobj_gm)
lobj_gmh <- spreg(CRIME ~ INC + HOVAL, columbus, listw,
model = "lag", het = TRUE)
summary(lobj_gmh)
set.seed(1)
impacts(lobj_gm, listw=listw)
impacts(lobj_gm, tr=trMatc)
impacts(lobj_gm, tr=trMC)
impacts(lobj_gm, evalues=ev)
impacts(lobj_gmh, listw=listw)
impacts(lobj_gmh, tr=trMatc)
impacts(lobj_gmh, tr=trMC)
impacts(lobj_gmh, evalues=ev)
#same impacts but different SD
summary(impacts(lobj_gm, evalues = ev, R = 1000))
summary(impacts(lobj_gmh, evalues = ev, R = 1000))
lobjIQ5_gm <- impacts(lobj_gm, tr=trMatc, R=1000, Q=5)
summary(lobjIQ5_gm, zstats=TRUE, short=TRUE)
summary(lobjIQ5_gm, zstats=TRUE, short=TRUE, reportQ=TRUE)
# LAG durbin TRUE
mobj_gm <- spreg(CRIME ~ INC + HOVAL, columbus, listw, Durbin=TRUE,
model = "lag")
summary(mobj_gm)
mobj_gmh <- spreg(CRIME ~ INC + HOVAL, columbus, listw, Durbin=TRUE,
model = "lag", het = TRUE)
mobj_gm2 <- spreg(CRIME ~ INC, columbus, listw, Durbin=TRUE,
model = "lag")
summary(mobj_gmh)
impacts(mobj_gm, KPformula = TRUE)
impacts(mobj_gm2, KPformula = TRUE)
summary(impacts(mobj_gm2, evalues=ev, R=1000), short=TRUE, zstats=TRUE)
impacts(mobj_gm, listw=listw)
impacts(mobj_gm, tr=trMatc)
impacts(mobj_gm, tr=trMC)
impacts(mobj_gm, evalues=ev)
summary(impacts(mobj_gm, evalues=ev, R=1000), short=TRUE, zstats=TRUE)
impacts(mobj_gmh, listw=listw)
impacts(mobj_gmh, tr=trMatc)
impacts(mobj_gmh, tr=trMC)
impacts(mobj_gmh, evalues=ev)
summary(impacts(mobj_gmh, tr=trMatc, R=1000), short=TRUE, zstats=TRUE)
#lag durbin = ~formula
mobj1_gm <- spreg(CRIME ~ INC + HOVAL, columbus, listw, Durbin= ~ INC,
model = "lag")
mobj1_gmh <- spreg(CRIME ~ INC + HOVAL, columbus, listw, Durbin= ~ INC,
model = "lag", het = TRUE)
impacts(mobj1_gm, tr=trMatc)
impacts(mobj1_gm, listw=listw)
impacts(mobj1_gm, KPformula = TRUE)
summary(impacts(mobj_gm, evalues=ev, R=200), short=TRUE, zstats=TRUE)
summary(impacts(mobj1_gm, tr=trMatc, R=200), short=TRUE, zstats=TRUE)
mobj1_gm <- spreg(CRIME ~ HOVAL, columbus, listw, Durbin= ~ INC,
model = "lag")
summary(impacts(mobj1_gm, evalues=ev, R=200), short=TRUE, zstats=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.