impacts.error_sphet: Generate impacts for objects of class error_sphet created in...

Description Usage Arguments Value Examples

View source: R/impacts.R

Description

Generate impacts for objects of class error_sphet created in sphet

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## S3 method for class 'error_sphet'
impacts(
  obj,
  ...,
  tr = NULL,
  R = NULL,
  listw = NULL,
  evalues = NULL,
  tol = 1e-06,
  empirical = FALSE,
  Q = NULL
)

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

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library(sphet)
require("sf", quietly=TRUE)
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)
error1 <- spreg(CRIME ~ INC + HOVAL, columbus, listw, Durbin=TRUE,
                model = "error")
summary(error1)
impacts(error1)
summary(impacts(error1))
error2 <- spreg(CRIME ~ INC + HOVAL, columbus, listw, Durbin= ~ INC,
                model = "error")
impacts(error2)
error3 <- spreg(CRIME ~ HOVAL, columbus, listw, Durbin= ~ INC,
                model = "error")
summary(impacts(error3))

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