impacts.stsls_sphet: Generate impacts for objects of class lag_gmm created in...

Description Usage Arguments Value References Examples

View source: R/impacts.R

Description

Generate impacts for objects of class lag_gmm created in sphet

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## 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
)

Arguments

obj

A spreg spatial regression object created by spreg with model ="lag"

...

Arguments passed through to methods in the coda package

tr

A vector of traces of powers of the spatial weights matrix created using trW, for approximate impact measures; if not given, listw must be given for exact measures (for small to moderate spatial weights matrices); the traces must be for the same spatial weights as were used in fitting the spatial regression

R

If given, simulations are used to compute distributions for the impact measures, returned as mcmc objects

listw

a listw object

evalues

vector of eigenvalues of spatial weights matrix for impacts calculations

tol

Argument passed to mvrnorm: tolerance (relative to largest variance) for numerical lack of positive-definiteness in the coefficient covariance matrix

empirical

Argument passed to mvrnorm (default FALSE): if true, the coefficients and their covariance matrix specify the empirical not population mean and covariance matrix

Q

default NULL, else an integer number of cumulative power series impacts to calculate if tr is given

KPformula

default FALSE, else inference of the impacts based on Kelejian and Piras (2020)

prt

prints the KP summary of the VC matrix

Value

Estimate of the Average Total, Average Direct, and Average Indirect Effects

References

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. https://onlinelibrary.wiley.com/doi/10.1111/jors.12476

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
require("sf", quietly=TRUE)
library(coda)
columbus <- st_read(system.file("shapes/columbus.shp", 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)

sphet documentation built on Jan. 6, 2022, 1:06 a.m.