| impacts.ols_sphet | R Documentation | 
Generate impacts for objects of class ols_sphet created in sphet
## S3 method for class 'ols_sphet'
impacts(
  obj,
  ...,
  tr = NULL,
  R = NULL,
  listw = NULL,
  evalues = NULL,
  tol = 1e-06,
  empirical = FALSE,
  Q = NULL
)
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   | 
Estimate of the Average Total, Average Direct, and Average Indirect Effects
data(boston, package="spData")
Wb <- as(spdep::nb2listw(boston.soi), "CsparseMatrix") 
ev <- eigen(Wb)$values
trMatb <- spatialreg::trW(Wb, type="mult")
lm.D <- spreg(log(CMEDV) ~ CRIM + ZN + INDUS + CHAS + I(NOX^2) + I(RM^2) +  AGE + log(DIS), 
          data = boston.c, listw = Wb, model = "ols", Durbin =  TRUE)
summary(lm.D)
impacts(lm.D)
summary(impacts(lm.D))
lm.D2 <- spreg(log(CMEDV) ~ CRIM + ZN + INDUS + CHAS + I(NOX^2) + I(RM^2) +  AGE + log(DIS), 
               data = boston.c, listw = Wb, model = "ols", Durbin =  ~AGE)
summary(lm.D2)
impacts(lm.D2)
summary(impacts(lm.D2))
lm.D3 <- spreg(log(CMEDV) ~ CRIM + ZN +  CHAS + I(NOX^2) + I(RM^2) +  AGE, 
               data = boston.c, listw = Wb, model = "ols", Durbin =  ~AGE + INDUS )
summary(lm.D3)
impacts(lm.D3)
summary(impacts(lm.D3))
require("sf", quietly=TRUE)
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)
knear <- spdep::knearneigh(cbind(columbus$X, columbus$Y), 5)
knb <- spdep::knn2nb(knear)
dist <- spdep::nbdists(knb, cbind(columbus$X, columbus$Y))
k5d <- spdep::nb2listw(knb, glist = dist, style = "B")
class(k5d) <- c("listw", "nb", "distance")
lm.D4 <- spreg(CRIME ~ INC + HOVAL, columbus, listw, Durbin=TRUE,
               model = "ols")
summary(lm.D4)
impacts(lm.D4)
lm.D5 <- spreg(CRIME ~ INC + HOVAL, columbus, listw, Durbin= ~ INC,
               model = "ols")
summary(lm.D5)
impacts(lm.D5)
summary(impacts(lm.D5))
lm.D6 <- spreg(CRIME ~ HOVAL, columbus, listw, Durbin= ~ INC,
               model = "ols")
summary(lm.D6)
summary(impacts(lm.D6))
## Not run: 
lm.D7 <- spreg(CRIME ~ INC + HOVAL, columbus, listw,
                 model = "ols", HAC = TRUE, distance = k5d, 
                                  type = "Triangular")
summary(lm.D7)
impacts(lm.D7)
summary(impacts(lm.D7))
## End(Not run)
lm.D8 <- spreg(CRIME ~ INC + HOVAL, data = columbus, listw = listw, Durbin=TRUE,
               model = "ols", distance = k5d, type = "Triangular")
summary(lm.D8)
impacts(lm.D8)
summary(impacts(lm.D8))
lmD.9 <- spreg(CRIME ~ INC + HOVAL, data = columbus, listw = listw, Durbin= ~ INC,
               model = "ols", distance = k5d, type = "Parzen")
               
impacts(lmD.9)
lmD.10 <- spreg(CRIME ~ HOVAL, columbus, listw, Durbin= ~ INC,
                model = "ols", distance = k5d, type = "Bisquare")
summary(lmD.10)
summary(impacts(lmD.10))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.