Impacts in spatial lag models
impacts.Rd
The calculation of impacts for spatial lag and spatial Durbin models is needed in order to interpret the regression coefficients correctly, because of the spillovers between the terms in these data generation processes (unlike the spatial error model). Methods for “SLX” and Bayesian fitted models are also provided, the former do not need MC simulations, while the latter pass through MCMC draws.
Usage
#\method{impacts}{sarlm}(obj, \dots, tr, R = NULL, listw = NULL, evalues=NULL,
# useHESS = NULL, tol = 1e-06, empirical = FALSE, Q=NULL)
#\method{impacts}{lagmess}(obj, ..., R=NULL, listw=NULL, tol=1e-6,
# empirical=FALSE)
#\method{impacts}{SLX}(obj, ...)
#\method{impacts}{MCMC_sar_g}(obj, ..., tr=NULL, listw=NULL, evalues=NULL, Q=NULL)
#\method{impacts}{MCMC_sem_g}(obj, ..., tr=NULL, listw=NULL, evalues=NULL, Q=NULL)
#\method{impacts}{MCMC_sac_g}(obj, ..., tr=NULL, listw=NULL, evalues=NULL, Q=NULL)
# S3 method for class 'LagImpact'
plot(x, ..., choice="direct", trace=FALSE, density=TRUE)
# S3 method for class 'LagImpact'
print(x, ..., reportQ=NULL)
# S3 method for class 'LagImpact'
summary(object, ..., zstats=FALSE, short=FALSE, reportQ=NULL)
#\method{print}{WXImpact}(x, ...)
#\method{summary}{WXImpact}(object, ..., adjust_k=(attr(object, "type") == "SDEM"))
# S3 method for class 'LagImpact'
HPDinterval(obj, prob = 0.95, ..., choice="direct")
intImpacts(rho, beta, P, n, mu, Sigma, irho, drop2beta, bnames, interval,
type, tr, R, listw, evalues, tol, empirical, Q, icept, iicept, p, mess=FALSE,
samples=NULL, zero_fill = NULL, dvars = NULL)
Arguments
- obj
A spatial regression object created by
lagsarlm
or bylmSLX
; inHPDinterval.LagImpact
, a LagImpact object- ...
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, and must be row-standardised- listw
If
tr
is not given, a spatial weights object as created bynb2listw
; they must be the same spatial weights as were used in fitting the spatial regression, but do not have to be row-standardised- evalues
vector of eigenvalues of spatial weights matrix for impacts calculations
- n
defaults to
length(obj$residuals)
; in the method forgmsar
objects it may be used in panel settings to compute the impacts for cross-sectional weights only, suggested by Angela Parenti- R
If given, simulations are used to compute distributions for the impact measures, returned as
mcmc
objects; the objects are used for convenience but are not output by an MCMC process- useHESS
Use the Hessian approximation (if available) even if the asymptotic coefficient covariance matrix is available; used for comparing methods
- 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- reportQ
default NULL; if TRUE and
Q
given as an argument toimpacts
, report impact components- x, object
LagImpact objects created by
impacts
methods- zstats
default FALSE, if TRUE, also return z-values and p-values for the impacts based on the simulations
- short
default FALSE, if TRUE passed to the print summary method to omit printing of the mcmc summaries
- choice
One of three impacts: direct, indirect, or total
- trace
Argument passed to
plot.mcmc
: plot trace plots- density
Argument passed to
plot.mcmc
: plot density plots- prob
Argument passed to
HPDinterval.mcmc
: a numeric scalar in the interval (0,1) giving the target probability content of the intervals- adjust_k
default TRUE if SDEM else FALSE, adjust internal OLS SDEM standard errors by dividing by n rather than (n-k) (default changed and bug fixed after 0.7-8; standard errors now ML in SDEM summary and impacts summary and identical - for SLX use FALSE)
- rho, beta, P, mu, Sigma, irho, drop2beta, bnames, interval, type, icept, iicept, p, mess, samples, zero_fill, dvars
internal arguments shared inside impacts methods
Details
If called without R
being set, the method returns the direct, indirect and total impacts for the variables in the model, for the variables themselves in tha spatial lag model case, for the variables and their spatial lags in the spatial Durbin (mixed) model case. The spatial lag impact measures are computed using eq. 2.46 (LeSage and Pace, 2009, p. 38), either using the exact dense matrix (when listw
is given), or traces of powers of the weights matrix (when tr
is given). When the traces are created by powering sparse matrices, the exact and the trace methods should give very similar results, unless the number of powers used is very small, or the spatial coefficient is close to its bounds.
If R
is given, simulations will be used to create distributions for the impact measures, provided that the fitted model object contains a coefficient covariance matrix. The simulations are made using mvrnorm
with the coefficients and their covariance matrix from the fitted model.
The simulations are stored as mcmc
objects as defined in the coda package; the objects are used for convenience but are not output by an MCMC process. The simulated values of the coefficients are checked to see that the spatial coefficient remains within its valid interval — draws outside the interval are discarded.
If a model is fitted with the “Durbin=” set to a formula subsetting the explanatory variables, the impacts object returned reports Durbin impacts for variables included in the formula and lag impacts for the other variables.
When Q
and tr
are given, addition impact component results are provided for each step in the traces of powers of the weights matrix up to and including the Q
'th power. This increases computing time because the output object is substantially increased in size in proportion to the size of Q
.
The method for gmsar
objects is only for those of type
SARAR
output by gstsls
, and assume that the spatial error coefficient is fixed, and thus omitted from the coefficients and covariance matrix used for simulation.
From version 1.4.1, functions for models including spatially lagged independent variables warn on fitting if any of the right-hand side variables are factors. This is because the interpretation of coefficients that are not slopes is unclear when the variable is not interpretable on an unbounded line, such as factors. Factor variable names are shown with the suffix “(F)”, others “dy/dx” in output from impact methods. A discussion can be found at https://github.com/rsbivand/eqc25_talk.
Value
An object of class LagImpact.
If no simulation is carried out, the object returned is a list with:
- direct
numeric vector
- indirect
numeric vector
- total
numeric vector
and a matching Qres
list attribute if Q
was given.
If simulation is carried out, the object returned is a list with:
- res
a list with three components as for the non-simulation case, with a matching
Qres
list attribute ifQ
was given- sres
a list with three
mcmc
matrices, for the direct, indirect and total impacts with a matchingQmcmc
list attribute ifQ
was given
References
LeSage J and RK Pace (2009) Introduction to Spatial Econometrics. CRC Press, Boca Raton, pp. 33–42, 114–115; LeSage J and MM Fischer (2008) Spatial growth regressions: model specification, estimation and interpretation. Spatial Economic Analysis 3 (3), pp. 275–304.
Roger Bivand, Gianfranco Piras (2015). Comparing Implementations of Estimation Methods for Spatial Econometrics. Journal of Statistical Software, 63(18), 1-36. doi:10.18637/jss.v063.i18 .
Author
Roger Bivand Roger.Bivand@nhh.no
Examples
require("sf", quietly=TRUE)
columbus <- st_read(system.file("shapes/columbus.gpkg", package="spData")[1], quiet=TRUE)
#require("spdep", quietly=TRUE)
col.gal.nb <- spdep::read.gal(system.file("weights/columbus.gal", package="spData")[1])
columbus$fEW <- factor(columbus$EW)
columbus$fDISCBD <- ordered(cut(columbus$DISCBD, c(0, 1.5, 3, 4.5, 6)))
run <- require("codingMatrices", quietly=TRUE)
f <- formula(log(CRIME) ~ INC + HOVAL + fDISCBD + fEW)
listw <- spdep::nb2listw(col.gal.nb)
ev <- eigenw(listw)
lobj <- lagsarlm(f, columbus, listw, control=list(pre_eig=ev))
summary(lobj)
#>
#> Call:
#> lagsarlm(formula = f, data = columbus, listw = listw, control = list(pre_eig = ev))
#>
#> Residuals:
#> Min 1Q Median 3Q Max
#> -3.887021 -0.265705 0.075038 0.351142 1.682544
#>
#> Type: lag
#> Coefficients: (asymptotic standard errors)
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) 6.1392333 0.7750510 7.9211 2.442e-15
#> INC -0.0520746 0.0297726 -1.7491 0.08028
#> HOVAL -0.0290994 0.0077396 -3.7598 0.00017
#> fDISCBD.L -0.1168456 0.3981785 -0.2935 0.76918
#> fDISCBD.Q 0.3670863 0.2549784 1.4397 0.14996
#> fDISCBD.C -0.0370120 0.2296689 -0.1612 0.87197
#> fEW1 0.0837988 0.2460444 0.3406 0.73342
#>
#> Rho: -0.30114, LR test value: 2.2103, p-value: 0.13709
#> Asymptotic standard error: 0.19387
#> z-value: -1.5534, p-value: 0.12034
#> Wald statistic: 2.4129, p-value: 0.12034
#>
#> Log likelihood: -60.69996 for lag model
#> ML residual variance (sigma squared): 0.68415, (sigma: 0.82714)
#> Number of observations: 49
#> Number of parameters estimated: 9
#> AIC: 139.4, (AIC for lm: 139.61)
#> LM test for residual autocorrelation
#> test value: 1.1851, p-value: 0.27632
#>
if (run) {
contrasts(columbus$fDISCBD) <- "code_diff"
lobjd <- lagsarlm(f, columbus, listw, control=list(pre_eig=ev))
}
mobj <- lagsarlm(f, columbus, listw, Durbin=TRUE, control=list(pre_eig=ev))
#> Warning: use of spatially lagged factors (categorical variables)
#> fDISCBD, fEW
#> is not well-understood
summary(mobj)
#>
#> Call:lagsarlm(formula = f, data = columbus, listw = listw, Durbin = TRUE,
#> control = list(pre_eig = ev))
#>
#> Residuals:
#> Min 1Q Median 3Q Max
#> -3.485440 -0.303568 0.057651 0.412917 1.618395
#>
#> Type: mixed
#> Coefficients: (asymptotic standard errors)
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) 7.2505614 1.5705214 4.6167 3.9e-06
#> INC -0.0511360 0.0317741 -1.6094 0.1075380
#> HOVAL -0.0284100 0.0078672 -3.6112 0.0003048
#> fDISCBDm2-m1 0.2649701 0.4829325 0.5487 0.5832325
#> fDISCBDm3-m2 0.2832158 0.4781799 0.5923 0.5536639
#> fDISCBDm4-m3 0.5248924 0.5018269 1.0460 0.2955780
#> fEW1 -0.0391368 0.5485068 -0.0714 0.9431180
#> lag.INC -0.0340158 0.0626300 -0.5431 0.5870447
#> lag.HOVAL -0.0056745 0.0174504 -0.3252 0.7450467
#> lag.fDISCBDm2-m1 -1.7168592 0.7865735 -2.1827 0.0290574
#> lag.fDISCBDm3-m2 0.2492410 0.7088775 0.3516 0.7251386
#> lag.fDISCBDm4-m3 -0.3272604 1.1177652 -0.2928 0.7696896
#> lag.fEW1 0.2155133 0.6636093 0.3248 0.7453632
#>
#> Rho: -0.43661, LR test value: 3.3537, p-value: 0.067054
#> Asymptotic standard error: 0.21519
#> z-value: -2.0289, p-value: 0.042467
#> Wald statistic: 4.1165, p-value: 0.042467
#>
#> Log likelihood: -58.21561 for mixed model
#> ML residual variance (sigma squared): 0.60545, (sigma: 0.7781)
#> Number of observations: 49
#> Number of parameters estimated: 15
#> AIC: 146.43, (AIC for lm: 147.78)
#> LM test for residual autocorrelation
#> test value: 5.1201, p-value: 0.02365
#>
mobj1 <- lagsarlm(f, columbus, listw, Durbin= ~ INC + HOVAL, control=list(pre_eig=ev))
summary(mobj1)
#>
#> Call:lagsarlm(formula = f, data = columbus, listw = listw, Durbin = ~INC +
#> HOVAL, control = list(pre_eig = ev))
#>
#> Residuals:
#> Min 1Q Median 3Q Max
#> -3.86709 -0.26174 0.01044 0.33923 1.70763
#>
#> Type: mixed
#> Coefficients: (asymptotic standard errors)
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) 6.6778949 1.3996025 4.7713 1.831e-06
#> INC -0.0512618 0.0303927 -1.6866 0.0916708
#> HOVAL -0.0294172 0.0079682 -3.6918 0.0002227
#> fDISCBDm2-m1 -0.4432283 0.3456691 -1.2822 0.1997610
#> fDISCBDm3-m2 0.0682508 0.4063270 0.1680 0.8666068
#> fDISCBDm4-m3 0.3660184 0.4599471 0.7958 0.4261577
#> fEW1 0.1093682 0.2634028 0.4152 0.6779863
#> lag.INC -0.0163520 0.0587022 -0.2786 0.7805832
#> lag.HOVAL -0.0036691 0.0165743 -0.2214 0.8248025
#>
#> Rho: -0.35002, LR test value: 2.1961, p-value: 0.13836
#> Asymptotic standard error: 0.21643
#> z-value: -1.6173, p-value: 0.10582
#> Wald statistic: 2.6155, p-value: 0.10582
#>
#> Log likelihood: -60.61159 for mixed model
#> ML residual variance (sigma squared): 0.67718, (sigma: 0.82291)
#> Number of observations: 49
#> Number of parameters estimated: 11
#> AIC: 143.22, (AIC for lm: 143.42)
#> LM test for residual autocorrelation
#> test value: 4.3874, p-value: 0.036205
#>
W <- as(listw, "CsparseMatrix")
trMatc <- trW(W, type="mult")
trMC <- trW(W, type="MC")
set.seed(1)
impacts(lobj, listw=listw)
#> Impact measures (lag, exact):
#> Direct Indirect Total
#> INC dy/dx -0.05306202 0.013039791 -0.04002223
#> HOVAL dy/dx -0.02965119 0.007286669 -0.02236453
#> fDISCBD.L (F) -0.11906113 0.029258822 -0.08980231
#> fDISCBD.Q (F) 0.37404673 -0.091920565 0.28212616
#> fDISCBD.C (F) -0.03771380 0.009268022 -0.02844577
#> fEW1 (F) 0.08538769 -0.020983702 0.06440399
if (run) {
impacts(lobjd, listw=listw)
}
#> Impact measures (lag, exact):
#> Direct Indirect Total
#> INC dy/dx -0.053062024 0.0130397910 -0.040022233
#> HOVAL dy/dx -0.029651195 0.0072866685 -0.022364526
#> fDISCBDm2-m1 (F) -0.461024722 0.1132950753 -0.347729647
#> fDISCBDm3-m2 (F) -0.002647386 0.0006505851 -0.001996801
#> fDISCBDm4-m3 (F) 0.287068727 -0.0705460500 0.216522677
#> fEW1 (F) 0.085387695 -0.0209837019 0.064403993
impacts(lobj, tr=trMatc)
#> Impact measures (lag, trace):
#> Direct Indirect Total
#> INC dy/dx -0.05306202 0.013039791 -0.04002223
#> HOVAL dy/dx -0.02965119 0.007286669 -0.02236453
#> fDISCBD.L (F) -0.11906113 0.029258822 -0.08980231
#> fDISCBD.Q (F) 0.37404673 -0.091920565 0.28212616
#> fDISCBD.C (F) -0.03771380 0.009268022 -0.02844577
#> fEW1 (F) 0.08538769 -0.020983702 0.06440399
impacts(lobj, tr=trMC)
#> Impact measures (lag, trace):
#> Direct Indirect Total
#> INC dy/dx -0.05306662 0.013044384 -0.04002223
#> HOVAL dy/dx -0.02965376 0.007289235 -0.02236453
#> fDISCBD.L (F) -0.11907144 0.029269127 -0.08980231
#> fDISCBD.Q (F) 0.37407910 -0.091952940 0.28212616
#> fDISCBD.C (F) -0.03771706 0.009271287 -0.02844577
#> fEW1 (F) 0.08539508 -0.020991093 0.06440399
impacts(lobj, evalues=ev)
#> Impact measures (lag, evalues):
#> Direct Indirect Total
#> INC dy/dx -0.05306202 0.013039791 -0.04002223
#> HOVAL dy/dx -0.02965119 0.007286669 -0.02236453
#> fDISCBD.L (F) -0.11906113 0.029258822 -0.08980231
#> fDISCBD.Q (F) 0.37404673 -0.091920565 0.28212616
#> fDISCBD.C (F) -0.03771380 0.009268022 -0.02844577
#> fEW1 (F) 0.08538769 -0.020983702 0.06440399
library(coda)
lobjIQ5 <- impacts(lobj, tr=trMatc, R=200, Q=5)
summary(lobjIQ5, zstats=TRUE, short=TRUE)
#> Impact measures (lag, trace):
#> Direct Indirect Total
#> INC dy/dx -0.05306202 0.013039791 -0.04002223
#> HOVAL dy/dx -0.02965119 0.007286669 -0.02236453
#> fDISCBD.L (F) -0.11906113 0.029258822 -0.08980231
#> fDISCBD.Q (F) 0.37404673 -0.091920565 0.28212616
#> fDISCBD.C (F) -0.03771380 0.009268022 -0.02844577
#> fEW1 (F) 0.08538769 -0.020983702 0.06440399
#> ========================================================
#> Simulation results ( variance matrix):
#> ========================================================
#> Simulated standard errors
#> Direct Indirect Total
#> INC dy/dx 0.032357639 0.011318159 0.026828034
#> HOVAL dy/dx 0.008460842 0.004750921 0.007544692
#> fDISCBD.L (F) 0.415062516 0.113760329 0.323208761
#> fDISCBD.Q (F) 0.271496369 0.094644703 0.213350587
#> fDISCBD.C (F) 0.253641590 0.066131588 0.197880926
#> fEW1 (F) 0.280462744 0.082242472 0.211686873
#>
#> Simulated z-values:
#> Direct Indirect Total
#> INC dy/dx -1.6493500 1.0888390 -1.5299451
#> HOVAL dy/dx -3.5830745 1.5252536 -3.0577087
#> fDISCBD.L (F) -0.3400607 0.4966262 -0.2619054
#> fDISCBD.Q (F) 1.4736046 -1.0103753 1.4270016
#> fDISCBD.C (F) -0.1492345 0.1357353 -0.1459245
#> fEW1 (F) 0.3517685 -0.2812783 0.3567766
#>
#> Simulated p-values:
#> Direct Indirect Total
#> INC dy/dx 0.09907595 0.27622 0.1260303
#> HOVAL dy/dx 0.00033957 0.12720 0.0022304
#> fDISCBD.L (F) 0.73381079 0.61945 0.7933944
#> fDISCBD.Q (F) 0.14058808 0.31232 0.1535794
#> fDISCBD.C (F) 0.88136863 0.89203 0.8839810
#> fEW1 (F) 0.72501192 0.77850 0.7212591
summary(lobjIQ5, zstats=TRUE, short=TRUE, reportQ=TRUE)
#> Impact measures (lag, trace):
#> Direct Indirect Total
#> INC dy/dx -0.05306202 0.013039791 -0.04002223
#> HOVAL dy/dx -0.02965119 0.007286669 -0.02236453
#> fDISCBD.L (F) -0.11906113 0.029258822 -0.08980231
#> fDISCBD.Q (F) 0.37404673 -0.091920565 0.28212616
#> fDISCBD.C (F) -0.03771380 0.009268022 -0.02844577
#> fEW1 (F) 0.08538769 -0.020983702 0.06440399
#> =================================
#> Impact components
#> $direct
#> INC dy/dx HOVAL dy/dx fDISCBD.L (F) fDISCBD.Q (F) fDISCBD.C (F)
#> Q1 -5.207463e-02 -2.909943e-02 -0.1168455984 0.3670863248 -3.701200e-02
#> Q2 0.000000e+00 0.000000e+00 0.0000000000 0.0000000000 0.000000e+00
#> Q3 -1.051311e-03 -5.874752e-04 -0.0023589426 0.0074109386 -7.472185e-04
#> Q4 1.059547e-04 5.920777e-05 0.0002377423 -0.0007468999 7.530725e-05
#> Q5 -4.911361e-05 -2.744481e-05 -0.0001102016 0.0003462134 -3.490746e-05
#> fEW1 (F)
#> Q1 8.379877e-02
#> Q2 0.000000e+00
#> Q3 1.691775e-03
#> Q4 -1.705029e-04
#> Q5 7.903388e-05
#>
#> $indirect
#> INC dy/dx HOVAL dy/dx fDISCBD.L (F) fDISCBD.Q (F) fDISCBD.C (F)
#> Q1 0.0000000000 0.0000000000 0.0000000000 0.000000000 0.0000000000
#> Q2 0.0156818807 0.0087630750 0.0351871702 -0.110545276 0.0111458856
#> Q3 -0.0036711691 -0.0020514587 -0.0082374082 0.025878937 -0.0026092809
#> Q4 0.0013161845 0.0007354873 0.0029532687 -0.009278095 0.0009354772
#> Q5 -0.0003791529 -0.0002118716 -0.0008507473 0.002672738 -0.0002694826
#> fEW1 (F)
#> Q1 0.0000000000
#> Q2 -0.0252353665
#> Q3 0.0059076650
#> Q4 -0.0021180111
#> Q5 0.0006101349
#>
#> $total
#> INC dy/dx HOVAL dy/dx fDISCBD.L (F) fDISCBD.Q (F) fDISCBD.C (F)
#> Q1 -0.0520746262 -0.0290994341 -0.1168455984 0.367086325 -0.0370120037
#> Q2 0.0156818807 0.0087630750 0.0351871702 -0.110545276 0.0111458856
#> Q3 -0.0047224800 -0.0026389339 -0.0105963508 0.033289876 -0.0033564993
#> Q4 0.0014221392 0.0007946950 0.0031910111 -0.010024995 0.0010107844
#> Q5 -0.0004282665 -0.0002393164 -0.0009609489 0.003018952 -0.0003043901
#> fEW1 (F)
#> Q1 0.0837987677
#> Q2 -0.0252353665
#> Q3 0.0075994402
#> Q4 -0.0022885141
#> Q5 0.0006891687
#>
#> ========================================================
#> Simulation results ( variance matrix):
#> ========================================================
#> Simulated standard errors
#> Direct Indirect Total
#> INC dy/dx 0.032357639 0.011318159 0.026828034
#> HOVAL dy/dx 0.008460842 0.004750921 0.007544692
#> fDISCBD.L (F) 0.415062516 0.113760329 0.323208761
#> fDISCBD.Q (F) 0.271496369 0.094644703 0.213350587
#> fDISCBD.C (F) 0.253641590 0.066131588 0.197880926
#> fEW1 (F) 0.280462744 0.082242472 0.211686873
#>
#> Simulated z-values:
#> Direct Indirect Total
#> INC dy/dx -1.6493500 1.0888390 -1.5299451
#> HOVAL dy/dx -3.5830745 1.5252536 -3.0577087
#> fDISCBD.L (F) -0.3400607 0.4966262 -0.2619054
#> fDISCBD.Q (F) 1.4736046 -1.0103753 1.4270016
#> fDISCBD.C (F) -0.1492345 0.1357353 -0.1459245
#> fEW1 (F) 0.3517685 -0.2812783 0.3567766
#>
#> Simulated p-values:
#> Direct Indirect Total
#> INC dy/dx 0.09907595 0.27622 0.1260303
#> HOVAL dy/dx 0.00033957 0.12720 0.0022304
#> fDISCBD.L (F) 0.73381079 0.61945 0.7933944
#> fDISCBD.Q (F) 0.14058808 0.31232 0.1535794
#> fDISCBD.C (F) 0.88136863 0.89203 0.8839810
#> fEW1 (F) 0.72501192 0.77850 0.7212591
#> ========================================================
#> Simulated impact components z-values:
#> $Direct
#> INC dy/dx HOVAL dy/dx fDISCBD.L (F) fDISCBD.Q (F) fDISCBD.C (F) fEW1 (F)
#> Q1 -1.6468901 -3.5967303 -0.3323984 1.4762686 -0.14949394 0.3538141
#> Q2 NaN NaN NaN NaN NaN NaN
#> Q3 -0.7574332 -0.9256686 -0.4268599 0.7073491 -0.09957003 0.2012658
#> Q4 0.5239537 0.6396654 0.3623024 -0.5115371 0.06206242 -0.1368570
#> Q5 -0.3903404 -0.4889234 -0.3043860 0.3931146 -0.03830825 0.0987072
#>
#> $Indirect
#> INC dy/dx HOVAL dy/dx fDISCBD.L (F) fDISCBD.Q (F) fDISCBD.C (F) fEW1 (F)
#> Q1 NaN NaN NaN NaN NaN NaN
#> Q2 1.0630591 1.4483439 0.4900057 -0.9791228 0.13318971 -0.2739262
#> Q3 -0.7574332 -0.9256686 -0.4268599 0.7073491 -0.09957003 0.2012658
#> Q4 0.5239537 0.6396654 0.3623024 -0.5115371 0.06206242 -0.1368570
#> Q5 -0.3903404 -0.4889234 -0.3043860 0.3931146 -0.03830825 0.0987072
#>
#> $Total
#> INC dy/dx HOVAL dy/dx fDISCBD.L (F) fDISCBD.Q (F) fDISCBD.C (F) fEW1 (F)
#> Q1 -1.6468901 -3.5967303 -0.3323984 1.4762686 -0.14949394 0.3538141
#> Q2 1.0630591 1.4483439 0.4900057 -0.9791228 0.13318971 -0.2739262
#> Q3 -0.7574332 -0.9256686 -0.4268599 0.7073491 -0.09957003 0.2012658
#> Q4 0.5239537 0.6396654 0.3623024 -0.5115371 0.06206242 -0.1368570
#> Q5 -0.3903404 -0.4889234 -0.3043860 0.3931146 -0.03830825 0.0987072
#>
#>
#> Simulated impact components p-values:
#> $Direct
#> INC dy/dx HOVAL dy/dx fDISCBD.L (F) fDISCBD.Q (F) fDISCBD.C (F) fEW1 (F)
#> Q1 0.099581 0.00032224 0.73959 0.13987 0.88116 0.72348
#> Q2 NA NA NA NA NA NA
#> Q3 0.448790 0.35461824 0.66948 0.47935 0.92069 0.84049
#> Q4 0.600311 0.52239017 0.71713 0.60898 0.95051 0.89114
#> Q5 0.696285 0.62489590 0.76083 0.69423 0.96944 0.92137
#>
#> $Indirect
#> INC dy/dx HOVAL dy/dx fDISCBD.L (F) fDISCBD.Q (F) fDISCBD.C (F) fEW1 (F)
#> Q1 NA NA NA NA NA NA
#> Q2 0.28776 0.14752 0.62413 0.32752 0.89404 0.78414
#> Q3 0.44879 0.35462 0.66948 0.47935 0.92069 0.84049
#> Q4 0.60031 0.52239 0.71713 0.60898 0.95051 0.89114
#> Q5 0.69628 0.62490 0.76083 0.69423 0.96944 0.92137
#>
#> $Total
#> INC dy/dx HOVAL dy/dx fDISCBD.L (F) fDISCBD.Q (F) fDISCBD.C (F) fEW1 (F)
#> Q1 0.099581 0.00032224 0.73959 0.13987 0.88116 0.72348
#> Q2 0.287755 0.14752090 0.62413 0.32752 0.89404 0.78414
#> Q3 0.448790 0.35461824 0.66948 0.47935 0.92069 0.84049
#> Q4 0.600311 0.52239017 0.71713 0.60898 0.95051 0.89114
#> Q5 0.696285 0.62489590 0.76083 0.69423 0.96944 0.92137
#>
impacts(mobj, listw=listw)
#> Impact measures (mixed, exact):
#> Direct Indirect Total
#> INC dy/dx -0.05007460 -0.009198133 -0.05927273
#> HOVAL dy/dx -0.02902104 0.005295429 -0.02372561
#> fDISCBDm2-m1 (F) 0.43136498 -1.442000098 -1.01063512
#> fDISCBDm3-m2 (F) 0.27181264 0.098821437 0.37063408
#> fDISCBDm4-m3 (F) 0.57541647 -0.437848169 0.13756830
#> fEW1 (F) -0.06025686 0.183029567 0.12277271
impacts(mobj, tr=trMatc)
#> Impact measures (mixed, trace):
#> Direct Indirect Total
#> INC dy/dx -0.05007460 -0.009198133 -0.05927273
#> HOVAL dy/dx -0.02902104 0.005295429 -0.02372561
#> fDISCBDm2-m1 (F) 0.43136498 -1.442000098 -1.01063512
#> fDISCBDm3-m2 (F) 0.27181264 0.098821437 0.37063408
#> fDISCBDm4-m3 (F) 0.57541647 -0.437848169 0.13756830
#> fEW1 (F) -0.06025686 0.183029567 0.12277271
impacts(mobj, tr=trMC)
#> Impact measures (mixed, trace):
#> Direct Indirect Total
#> INC dy/dx -0.05006587 -0.009206860 -0.05927273
#> HOVAL dy/dx -0.02902606 0.005300453 -0.02372561
#> fDISCBDm2-m1 (F) 0.43273311 -1.443368230 -1.01063512
#> fDISCBDm3-m2 (F) 0.27171888 0.098915196 0.37063408
#> fDISCBDm4-m3 (F) 0.57583189 -0.438263588 0.13756830
#> fEW1 (F) -0.06043051 0.183203221 0.12277271
impacts(mobj1, tr=trMatc)
#> Impact measures (mixed, trace):
#> Direct Indirect Total
#> INC dy/dx -0.05137786 0.001294350 -0.05008351
#> HOVAL dy/dx -0.02990055 0.005392585 -0.02450797
#> fDISCBDm2-m1 (F) -0.45454225 0.126230607 -0.32831165
#> fDISCBDm3-m2 (F) 0.06999298 -0.019437700 0.05055528
#> fDISCBDm4-m3 (F) 0.37536154 -0.104241388 0.27112015
#> fEW1 (F) 0.11215995 -0.031147860 0.08101209
impacts(mobj1, listw=listw)
#> Impact measures (mixed, exact):
#> Direct Indirect Total
#> INC dy/dx -0.05137786 0.001294350 -0.05008351
#> HOVAL dy/dx -0.02990055 0.005392585 -0.02450797
#> fDISCBDm2-m1 (F) -0.45454225 0.126230607 -0.32831165
#> fDISCBDm3-m2 (F) 0.06999298 -0.019437700 0.05055528
#> fDISCBDm4-m3 (F) 0.37536154 -0.104241388 0.27112015
#> fEW1 (F) 0.11215995 -0.031147860 0.08101209
# \dontrun{
try(impacts(mobj, evalues=ev), silent=TRUE)
#> Impact measures (mixed, evalues):
#> Direct Indirect Total
#> INC dy/dx -0.05007460 -0.009198133 -0.05927273
#> HOVAL dy/dx -0.02902104 0.005295429 -0.02372561
#> fDISCBDm2-m1 (F) 0.43136498 -1.442000098 -1.01063512
#> fDISCBDm3-m2 (F) 0.27181264 0.098821437 0.37063408
#> fDISCBDm4-m3 (F) 0.57541647 -0.437848169 0.13756830
#> fEW1 (F) -0.06025686 0.183029567 0.12277271
# }
summary(impacts(mobj, tr=trMatc, R=200), short=TRUE, zstats=TRUE)
#> Impact measures (mixed, trace):
#> Direct Indirect Total
#> INC dy/dx -0.05007460 -0.009198133 -0.05927273
#> HOVAL dy/dx -0.02902104 0.005295429 -0.02372561
#> fDISCBDm2-m1 (F) 0.43136498 -1.442000098 -1.01063512
#> fDISCBDm3-m2 (F) 0.27181264 0.098821437 0.37063408
#> fDISCBDm4-m3 (F) 0.57541647 -0.437848169 0.13756830
#> fEW1 (F) -0.06025686 0.183029567 0.12277271
#> ========================================================
#> Simulation results ( variance matrix):
#> ========================================================
#> Simulated standard errors
#> Direct Indirect Total
#> INC dy/dx 0.036962648 0.05084747 0.04972074
#> HOVAL dy/dx 0.008679655 0.01482206 0.01176581
#> fDISCBDm2-m1 (F) 0.551312924 0.73671856 0.45516098
#> fDISCBDm3-m2 (F) 0.525097382 0.67920183 0.45487957
#> fDISCBDm4-m3 (F) 0.661906894 1.09489180 0.76794194
#> fEW1 (F) 0.680044348 0.75184225 0.24268354
#>
#> Simulated z-values:
#> Direct Indirect Total
#> INC dy/dx -1.35293720 -0.2537862 -1.2653176
#> HOVAL dy/dx -3.32927424 0.3936154 -1.9601510
#> fDISCBDm2-m1 (F) 0.74577317 -1.9776269 -2.2976488
#> fDISCBDm3-m2 (F) 0.62314115 0.0750689 0.8314216
#> fDISCBDm4-m3 (F) 0.95358365 -0.3884948 0.2680201
#> fEW1 (F) -0.03949598 0.2108893 0.5426674
#>
#> Simulated p-values:
#> Direct Indirect Total
#> INC dy/dx 0.17607569 0.799661 0.205758
#> HOVAL dy/dx 0.00087073 0.693865 0.049978
#> fDISCBDm2-m1 (F) 0.45580445 0.047971 0.021582
#> fDISCBDm3-m2 (F) 0.53319177 0.940160 0.405735
#> fDISCBDm4-m3 (F) 0.34029443 0.697650 0.788684
#> fEW1 (F) 0.96849496 0.832974 0.587359
summary(impacts(mobj1, tr=trMatc, R=200), short=TRUE, zstats=TRUE)
#> Impact measures (mixed, trace):
#> Direct Indirect Total
#> INC dy/dx -0.05137786 0.001294350 -0.05008351
#> HOVAL dy/dx -0.02990055 0.005392585 -0.02450797
#> fDISCBDm2-m1 (F) -0.45454225 0.126230607 -0.32831165
#> fDISCBDm3-m2 (F) 0.06999298 -0.019437700 0.05055528
#> fDISCBDm4-m3 (F) 0.37536154 -0.104241388 0.27112015
#> fEW1 (F) 0.11215995 -0.031147860 0.08101209
#> ========================================================
#> Simulation results ( variance matrix):
#> ========================================================
#> Simulated standard errors
#> Direct Indirect Total
#> INC dy/dx 0.034248289 0.05477142 0.04560629
#> HOVAL dy/dx 0.008468381 0.01412591 0.01200802
#> fDISCBDm2-m1 (F) 0.353746836 0.13088559 0.26498052
#> fDISCBDm3-m2 (F) 0.421952840 0.12808010 0.31192428
#> fDISCBDm4-m3 (F) 0.450381737 0.15216548 0.33350061
#> fEW1 (F) 0.262734596 0.07858056 0.19886190
#>
#> Simulated z-values:
#> Direct Indirect Total
#> INC dy/dx -1.53673262 0.07026954 -1.06962658
#> HOVAL dy/dx -3.59935327 0.44527347 -2.01455278
#> fDISCBDm2-m1 (F) -1.36488339 1.02925565 -1.31371337
#> fDISCBDm3-m2 (F) 0.09403281 -0.10895446 0.08246396
#> fDISCBDm4-m3 (F) 0.83192598 -0.63486152 0.83382235
#> fEW1 (F) 0.47753970 -0.40814243 0.46964319
#>
#> Simulated p-values:
#> Direct Indirect Total
#> INC dy/dx 0.12435880 0.94398 0.284787
#> HOVAL dy/dx 0.00031901 0.65612 0.043952
#> fDISCBDm2-m1 (F) 0.17228970 0.30336 0.188943
#> fDISCBDm3-m2 (F) 0.92508310 0.91324 0.934278
#> fDISCBDm4-m3 (F) 0.40545073 0.52552 0.404381
#> fEW1 (F) 0.63297786 0.68317 0.638610
xobj <- lmSLX(f, columbus, listw)
#> Warning: use of spatially lagged factors (categorical variables)
#> fDISCBD, fEW
#> is not well-understood
summary(impacts(xobj))
#> Impact measures (SlX, glht, n-k):
#> Direct Indirect Total
#> INC dy/dx -0.05127030 -0.01300677 -0.06427708
#> HOVAL dy/dx -0.02823116 0.00776633 -0.02046483
#> fDISCBDm2-m1 (F) 0.30550205 -1.48251556 -1.17701351
#> fDISCBDm3-m2 (F) 0.19545891 0.36450618 0.55996509
#> fDISCBDm4-m3 (F) 0.52090107 -0.56818138 -0.04728031
#> fEW1 (F) -0.05759815 0.25527403 0.19767588
#> ========================================================
#> Standard errors:
#> Direct Indirect Total
#> INC dy/dx 0.039113827 0.07595938 0.08320131
#> HOVAL dy/dx 0.009684776 0.02041006 0.01996799
#> fDISCBDm2-m1 (F) 0.589593465 0.96642237 0.67596041
#> fDISCBDm3-m2 (F) 0.588701391 0.87056187 0.75333500
#> fDISCBDm4-m3 (F) 0.617427646 1.37625313 1.23485161
#> fEW1 (F) 0.675512118 0.81732233 0.38451537
#> ========================================================
#> Z-values:
#> Direct Indirect Total
#> INC dy/dx -1.3107974 -0.1712333 -0.77254884
#> HOVAL dy/dx -2.9150036 0.3805147 -1.02488147
#> fDISCBDm2-m1 (F) 0.5181571 -1.5340245 -1.74124623
#> fDISCBDm3-m2 (F) 0.3320171 0.4187022 0.74331484
#> fDISCBDm4-m3 (F) 0.8436633 -0.4128466 -0.03828825
#> fEW1 (F) -0.0852659 0.3123297 0.51409098
#>
#> p-values:
#> Direct Indirect Total
#> INC dy/dx 0.1899262 0.86404 0.43979
#> HOVAL dy/dx 0.0035568 0.70356 0.30542
#> fDISCBDm2-m1 (F) 0.6043487 0.12502 0.08164
#> fDISCBDm3-m2 (F) 0.7398764 0.67543 0.45729
#> fDISCBDm4-m3 (F) 0.3988576 0.67972 0.96946
#> fEW1 (F) 0.9320500 0.75479 0.60719
#>
eobj <- errorsarlm(f, columbus, listw, etype="emixed")
#> Warning: use of spatially lagged factors (categorical variables)
#> fDISCBD, fEW
#> is not well-understood
summary(impacts(eobj), adjust_k=TRUE)
#> Impact measures (SDEM, glht, n):
#> Direct Indirect Total
#> INC dy/dx -0.05700667 -0.014643459 -0.07165013
#> HOVAL dy/dx -0.02851468 0.002480578 -0.02603410
#> fDISCBDm2-m1 dy/dx 0.53615183 -1.821801604 -1.28564977
#> fDISCBDm3-m2 dy/dx 0.44837745 -0.008451605 0.43992584
#> fDISCBDm4-m3 dy/dx 0.57159014 -0.134565014 0.43702512
#> fEW1 dy/dx -0.09418651 0.247893670 0.15370716
#> ========================================================
#> Standard errors:
#> Direct Indirect Total
#> INC dy/dx 0.033522267 0.05500753 0.05177221
#> HOVAL dy/dx 0.008460333 0.01570895 0.01266713
#> fDISCBDm2-m1 dy/dx 0.526900798 0.80321952 0.43061797
#> fDISCBDm3-m2 dy/dx 0.525906684 0.70085294 0.45630345
#> fDISCBDm4-m3 dy/dx 0.535329561 1.11949891 0.87187542
#> fEW1 dy/dx 0.579445970 0.67806872 0.22642612
#> ========================================================
#> Z-values:
#> Direct Indirect Total
#> INC dy/dx -1.7005614 -0.26620825 -1.3839496
#> HOVAL dy/dx -3.3703965 0.15790853 -2.0552477
#> fDISCBDm2-m1 dy/dx 1.0175575 -2.26812418 -2.9855925
#> fDISCBDm3-m2 dy/dx 0.8525799 -0.01205903 0.9641081
#> fDISCBDm4-m3 dy/dx 1.0677351 -0.12020111 0.5012472
#> fEW1 dy/dx -0.1625458 0.36558783 0.6788402
#>
#> p-values:
#> Direct Indirect Total
#> INC dy/dx 0.0890254 0.790079 0.1663739
#> HOVAL dy/dx 0.0007506 0.874529 0.0398551
#> fDISCBDm2-m1 dy/dx 0.3088883 0.023322 0.0028303
#> fDISCBDm3-m2 dy/dx 0.3938923 0.990379 0.3349918
#> fDISCBDm4-m3 dy/dx 0.2856400 0.904324 0.6161972
#> fEW1 dy/dx 0.8708761 0.714673 0.4972391
#>
# \dontrun{
mobj1 <- lagsarlm(f, columbus, listw, type="mixed",
method="Matrix", control=list(fdHess=TRUE))
#> Warning: use of spatially lagged factors (categorical variables)
#> fDISCBD, fEW
#> is not well-understood
summary(mobj1)
#>
#> Call:lagsarlm(formula = f, data = columbus, listw = listw, type = "mixed",
#> method = "Matrix", control = list(fdHess = TRUE))
#>
#> Residuals:
#> Min 1Q Median 3Q Max
#> -3.485440 -0.303568 0.057651 0.412917 1.618395
#>
#> Type: mixed
#> Coefficients: (asymptotic standard errors)
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) 7.2505613 1.6930845 4.2825 1.848e-05
#> INC -0.0511360 0.0317573 -1.6102 0.1073513
#> HOVAL -0.0284100 0.0078616 -3.6138 0.0003018
#> fDISCBDm2-m1 0.2649702 0.4784131 0.5539 0.5796800
#> fDISCBDm3-m2 0.2832158 0.4791218 0.5911 0.5544438
#> fDISCBDm4-m3 0.5248924 0.5011489 1.0474 0.2949252
#> fEW1 -0.0391368 0.5390224 -0.0726 0.9421189
#> lag.INC -0.0340158 0.0626273 -0.5431 0.5870287
#> lag.HOVAL -0.0056745 0.0180359 -0.3146 0.7530494
#> lag.fDISCBDm2-m1 -1.7168592 0.7939419 -2.1624 0.0305835
#> lag.fDISCBDm3-m2 0.2492410 0.7084643 0.3518 0.7249848
#> lag.fDISCBDm4-m3 -0.3272604 1.1247038 -0.2910 0.7710707
#> lag.fEW1 0.2155133 0.6538676 0.3296 0.7417039
#>
#> Rho: -0.43661, LR test value: 3.3537, p-value: 0.067054
#> Asymptotic standard error: 0.23242
#> z-value: -1.8785, p-value: 0.060309
#> Wald statistic: 3.5289, p-value: 0.060309
#>
#> Log likelihood: -58.21561 for mixed model
#> ML residual variance (sigma squared): 0.60545, (sigma: 0.7781)
#> Number of observations: 49
#> Number of parameters estimated: 15
#> AIC: 146.43, (AIC for lm: 147.78)
#> LM test for residual autocorrelation
#> test value: 5.1201, p-value: 0.02365
#>
set.seed(1)
summary(impacts(mobj1, tr=trMatc, R=1000), zstats=TRUE, short=TRUE)
#> Impact measures (mixed, trace):
#> Direct Indirect Total
#> INC dy/dx -0.05007460 -0.009198133 -0.05927273
#> HOVAL dy/dx -0.02902104 0.005295429 -0.02372561
#> fDISCBDm2-m1 (F) 0.43136497 -1.442000095 -1.01063513
#> fDISCBDm3-m2 (F) 0.27181264 0.098821456 0.37063409
#> fDISCBDm4-m3 (F) 0.57541647 -0.437848175 0.13756829
#> fEW1 (F) -0.06025686 0.183029571 0.12277271
#> ========================================================
#> Simulation results ( variance matrix):
#> ========================================================
#> Simulated standard errors
#> Direct Indirect Total
#> INC dy/dx 0.034777469 0.05306687 0.05023350
#> HOVAL dy/dx 0.008757124 0.01395932 0.01124856
#> fDISCBDm2-m1 (F) 0.574486602 0.77890912 0.40899170
#> fDISCBDm3-m2 (F) 0.540845185 0.66541390 0.44286234
#> fDISCBDm4-m3 (F) 0.591570656 1.02156938 0.72434284
#> fEW1 (F) 0.660106155 0.73432393 0.22946673
#>
#> Simulated z-values:
#> Direct Indirect Total
#> INC dy/dx -1.4110878 -0.1933727 -1.1811987
#> HOVAL dy/dx -3.3180852 0.4090151 -2.0755824
#> fDISCBDm2-m1 (F) 0.7300076 -1.8522019 -2.5020492
#> fDISCBDm3-m2 (F) 0.4935226 0.1631910 0.8479133
#> fDISCBDm4-m3 (F) 0.9502864 -0.4185751 0.1857657
#> fEW1 (F) -0.0740122 0.2404616 0.5565985
#>
#> Simulated p-values:
#> Direct Indirect Total
#> INC dy/dx 0.15821874 0.846667 0.237524
#> HOVAL dy/dx 0.00090637 0.682529 0.037933
#> fDISCBDm2-m1 (F) 0.46538554 0.063997 0.012348
#> fDISCBDm3-m2 (F) 0.62164339 0.870368 0.396486
#> fDISCBDm4-m3 (F) 0.34196672 0.675527 0.852628
#> fEW1 (F) 0.94100068 0.809972 0.577802
summary(impacts(mobj, tr=trMatc, R=1000), zstats=TRUE, short=TRUE)
#> Impact measures (mixed, trace):
#> Direct Indirect Total
#> INC dy/dx -0.05007460 -0.009198133 -0.05927273
#> HOVAL dy/dx -0.02902104 0.005295429 -0.02372561
#> fDISCBDm2-m1 (F) 0.43136498 -1.442000098 -1.01063512
#> fDISCBDm3-m2 (F) 0.27181264 0.098821437 0.37063408
#> fDISCBDm4-m3 (F) 0.57541647 -0.437848169 0.13756830
#> fEW1 (F) -0.06025686 0.183029567 0.12277271
#> ========================================================
#> Simulation results ( variance matrix):
#> ========================================================
#> Simulated standard errors
#> Direct Indirect Total
#> INC dy/dx 0.035660554 0.18739091 0.19400671
#> HOVAL dy/dx 0.009052111 0.03900344 0.03869308
#> fDISCBDm2-m1 (F) 0.563738191 2.25669654 2.28983204
#> fDISCBDm3-m2 (F) 0.547196282 1.33552735 1.30244644
#> fDISCBDm4-m3 (F) 0.586975252 1.34334825 1.18454602
#> fEW1 (F) 0.627732946 0.83606135 0.58100282
#>
#> Simulated z-values:
#> Direct Indirect Total
#> INC dy/dx -1.3821426 -0.00573716 -0.25959445
#> HOVAL dy/dx -3.1952198 0.19064004 -0.55534142
#> fDISCBDm2-m1 (F) 0.7559109 -0.58263655 -0.38810622
#> fDISCBDm3-m2 (F) 0.4462675 0.05550360 0.24440352
#> fDISCBDm4-m3 (F) 1.0569157 -0.37754296 0.09557391
#> fEW1 (F) -0.1132405 0.19267326 0.15490780
#>
#> Simulated p-values:
#> Direct Indirect Total
#> INC dy/dx 0.1669279 0.99542 0.79518
#> HOVAL dy/dx 0.0013972 0.84881 0.57866
#> fDISCBDm2-m1 (F) 0.4497026 0.56014 0.69794
#> fDISCBDm3-m2 (F) 0.6554040 0.95574 0.80692
#> fDISCBDm4-m3 (F) 0.2905501 0.70577 0.92386
#> fEW1 (F) 0.9098399 0.84721 0.87689
mobj2 <- lagsarlm(f, columbus, listw, type="mixed",
method="Matrix", control=list(fdHess=TRUE, optimHess=TRUE))
#> Warning: use of spatially lagged factors (categorical variables)
#> fDISCBD, fEW
#> is not well-understood
summary(impacts(mobj2, tr=trMatc, R=1000), zstats=TRUE, short=TRUE)
#> Impact measures (mixed, trace):
#> Direct Indirect Total
#> INC dy/dx -0.05007460 -0.009198133 -0.05927273
#> HOVAL dy/dx -0.02902104 0.005295429 -0.02372561
#> fDISCBDm2-m1 (F) 0.43136497 -1.442000095 -1.01063513
#> fDISCBDm3-m2 (F) 0.27181264 0.098821456 0.37063409
#> fDISCBDm4-m3 (F) 0.57541647 -0.437848175 0.13756829
#> fEW1 (F) -0.06025686 0.183029571 0.12277271
#> ========================================================
#> Simulation results ( variance matrix):
#> ========================================================
#> Simulated standard errors
#> Direct Indirect Total
#> INC dy/dx 0.035555131 0.05073204 0.04855824
#> HOVAL dy/dx 0.009468544 0.01533706 0.01182661
#> fDISCBDm2-m1 (F) 0.564446479 0.77204966 0.41679801
#> fDISCBDm3-m2 (F) 0.556314915 0.66843055 0.44155612
#> fDISCBDm4-m3 (F) 0.584109404 0.99122774 0.71106337
#> fEW1 (F) 0.638102169 0.70572005 0.22862357
#>
#> Simulated z-values:
#> Direct Indirect Total
#> INC dy/dx -1.4188927 -0.2356718 -1.2851583
#> HOVAL dy/dx -3.1019019 0.3955657 -1.9704446
#> fDISCBDm2-m1 (F) 0.8204812 -1.9113140 -2.4292620
#> fDISCBDm3-m2 (F) 0.5244398 0.1674555 0.9142350
#> fDISCBDm4-m3 (F) 1.0164971 -0.4802347 0.1655598
#> fEW1 (F) -0.1148537 0.2858752 0.5618821
#>
#> Simulated p-values:
#> Direct Indirect Total
#> INC dy/dx 0.1559303 0.813687 0.198737
#> HOVAL dy/dx 0.0019228 0.692425 0.048787
#> fDISCBDm2-m1 (F) 0.4119418 0.055964 0.015130
#> fDISCBDm3-m2 (F) 0.5999727 0.867012 0.360593
#> fDISCBDm4-m3 (F) 0.3093927 0.631060 0.868503
#> fEW1 (F) 0.9085611 0.774974 0.574196
mobj3 <- lagsarlm(f, columbus, listw, type="mixed",
method="spam", control=list(fdHess=TRUE))
#> Warning: use of spatially lagged factors (categorical variables)
#> fDISCBD, fEW
#> is not well-understood
summary(impacts(mobj3, tr=trMatc, R=1000), zstats=TRUE, short=TRUE)
#> Impact measures (mixed, trace):
#> Direct Indirect Total
#> INC dy/dx -0.05007460 -0.009198133 -0.05927273
#> HOVAL dy/dx -0.02902104 0.005295429 -0.02372561
#> fDISCBDm2-m1 (F) 0.43136496 -1.442000094 -1.01063513
#> fDISCBDm3-m2 (F) 0.27181263 0.098821462 0.37063409
#> fDISCBDm4-m3 (F) 0.57541647 -0.437848177 0.13756829
#> fEW1 (F) -0.06025686 0.183029573 0.12277271
#> ========================================================
#> Simulation results ( variance matrix):
#> ========================================================
#> Simulated standard errors
#> Direct Indirect Total
#> INC dy/dx 0.032618931 0.05105639 0.04875442
#> HOVAL dy/dx 0.008654348 0.01470922 0.01194568
#> fDISCBDm2-m1 (F) 0.557217837 0.75196428 0.40304357
#> fDISCBDm3-m2 (F) 0.550444960 0.68691292 0.44978564
#> fDISCBDm4-m3 (F) 0.593198232 1.02976687 0.75458758
#> fEW1 (F) 0.629329528 0.70272234 0.22678867
#>
#> Simulated z-values:
#> Direct Indirect Total
#> INC dy/dx -1.49049029 -0.1839322 -1.1898226
#> HOVAL dy/dx -3.37140216 0.4229281 -1.9217270
#> fDISCBDm2-m1 (F) 0.75319414 -1.9117134 -2.5254018
#> fDISCBDm3-m2 (F) 0.44211057 0.1718926 0.8035667
#> fDISCBDm4-m3 (F) 1.01133586 -0.4743450 0.1477070
#> fEW1 (F) -0.09473353 0.2588692 0.5392446
#>
#> Simulated p-values:
#> Direct Indirect Total
#> INC dy/dx 0.13609537 0.854067 0.234116
#> HOVAL dy/dx 0.00074787 0.672348 0.054640
#> fDISCBDm2-m1 (F) 0.45133326 0.055913 0.011557
#> fDISCBDm3-m2 (F) 0.65840919 0.863522 0.421647
#> fDISCBDm4-m3 (F) 0.31185571 0.635254 0.882574
#> fEW1 (F) 0.92452649 0.795736 0.589718
# }
# \dontrun{
data(boston, package="spData")
Wb <- as(spdep::nb2listw(boston.soi), "CsparseMatrix")
trMatb <- trW(Wb, type="mult")
gp2mMi <- lagsarlm(log(CMEDV) ~ CRIM + ZN + INDUS + CHAS + I(NOX^2) +
I(RM^2) + AGE + log(DIS) + log(RAD) + TAX + PTRATIO + B + log(LSTAT),
data=boston.c, spdep::nb2listw(boston.soi), Durbin=TRUE, method="Matrix",
control=list(fdHess=TRUE), trs=trMatb)
#> Warning: use of spatially lagged factor (categorical variable)
#> CHAS
#> is not well-understood
summary(gp2mMi)
#>
#> Call:lagsarlm(formula = log(CMEDV) ~ CRIM + ZN + INDUS + CHAS + I(NOX^2) +
#> I(RM^2) + AGE + log(DIS) + log(RAD) + TAX + PTRATIO + B +
#> log(LSTAT), data = boston.c, listw = spdep::nb2listw(boston.soi),
#> Durbin = TRUE, method = "Matrix", trs = trMatb, control = list(fdHess = TRUE))
#>
#> Residuals:
#> Min 1Q Median 3Q Max
#> -0.6316833 -0.0629790 -0.0090776 0.0682421 0.6991072
#>
#> Type: mixed
#> Coefficients: (asymptotic standard errors)
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) 1.89816225 0.24400199 7.7793 7.327e-15
#> CRIM -0.00571021 0.00093857 -6.0839 1.173e-09
#> ZN 0.00069091 0.00051874 1.3319 0.1828931
#> INDUS -0.00111343 0.00307380 -0.3622 0.7171778
#> CHAS1 -0.04163225 0.02738839 -1.5201 0.1284937
#> I(NOX^2) -0.01034950 0.19358633 -0.0535 0.9573639
#> I(RM^2) 0.00794979 0.00102109 7.7856 6.883e-15
#> AGE -0.00128789 0.00048929 -2.6322 0.0084838
#> log(DIS) -0.12404108 0.09510145 -1.3043 0.1921304
#> log(RAD) 0.05863502 0.02257529 2.5973 0.0093957
#> TAX -0.00049084 0.00012146 -4.0412 5.317e-05
#> PTRATIO -0.01319853 0.00595331 -2.2170 0.0266227
#> B 0.00056383 0.00011084 5.0867 3.643e-07
#> log(LSTAT) -0.24724454 0.02265149 -10.9152 < 2.2e-16
#> lag.CRIM -0.00464215 0.00173900 -2.6694 0.0075978
#> lag.ZN -0.00037937 0.00070703 -0.5366 0.5915659
#> lag.INDUS 0.00025064 0.00385911 0.0649 0.9482165
#> lag.CHAS1 0.12518252 0.04083949 3.0652 0.0021750
#> lag.I(NOX^2) -0.38640403 0.22253428 -1.7364 0.0824967
#> lag.I(RM^2) -0.00451252 0.00148919 -3.0302 0.0024440
#> lag.AGE 0.00149678 0.00068470 2.1860 0.0288128
#> lag.log(DIS) -0.00453785 0.10056961 -0.0451 0.9640104
#> lag.log(RAD) -0.00940702 0.03127787 -0.3008 0.7636002
#> lag.TAX 0.00041083 0.00017859 2.3004 0.0214237
#> lag.PTRATIO 0.00060355 0.00789994 0.0764 0.9391011
#> lag.B -0.00050781 0.00014107 -3.5996 0.0003187
#> lag.log(LSTAT) 0.09846780 0.03574183 2.7550 0.0058697
#>
#> Rho: 0.59578, LR test value: 181.68, p-value: < 2.22e-16
#> Asymptotic standard error: 0.037474
#> z-value: 15.899, p-value: < 2.22e-16
#> Wald statistic: 252.76, p-value: < 2.22e-16
#>
#> Log likelihood: 300.6131 for mixed model
#> ML residual variance (sigma squared): 0.016011, (sigma: 0.12654)
#> Number of observations: 506
#> Number of parameters estimated: 29
#> AIC: -543.23, (AIC for lm: -363.55)
#> LM test for residual autocorrelation
#> test value: 29.772, p-value: 4.8604e-08
#>
summary(impacts(gp2mMi, tr=trMatb, R=1000), zstats=TRUE, short=TRUE)
#> Impact measures (mixed, trace):
#> Direct Indirect Total
#> CRIM dy/dx -0.0074555753 -0.0181548470 -0.0256104223
#> ZN dy/dx 0.0006979073 0.0000727985 0.0007707058
#> INDUS dy/dx -0.0012029822 -0.0009314672 -0.0021344494
#> CHAS1 (F) -0.0198526431 0.2265453878 0.2066927447
#> I(NOX^2) dy/dx -0.0955268251 -0.8859909283 -0.9815177534
#> I(RM^2) dy/dx 0.0079983430 0.0005050175 0.0085033605
#> AGE dy/dx -0.0011296134 0.0016463650 0.0005167515
#> log(DIS) dy/dx -0.1410601685 -0.1770277708 -0.3180879393
#> log(RAD) dy/dx 0.0641735546 0.0576102594 0.1217838140
#> TAX dy/dx -0.0004651543 0.0002672119 -0.0001979424
#> PTRATIO dy/dx -0.0147737151 -0.0163846522 -0.0311583673
#> B dy/dx 0.0005265343 -0.0003879424 0.0001385920
#> log(LSTAT) dy/dx -0.2578403220 -0.1102143882 -0.3680547102
#> ========================================================
#> Simulation results ( variance matrix):
#> ========================================================
#> Simulated standard errors
#> Direct Indirect Total
#> CRIM dy/dx 0.0009960006 0.0036424839 0.0041047328
#> ZN dy/dx 0.0004924859 0.0012155865 0.0012712450
#> INDUS dy/dx 0.0029397626 0.0058970655 0.0052944318
#> CHAS1 (F) 0.0270654569 0.0793586015 0.0865170638
#> I(NOX^2) dy/dx 0.1797650855 0.2891620662 0.2380146033
#> I(RM^2) dy/dx 0.0011033785 0.0031208010 0.0036485340
#> AGE dy/dx 0.0004754896 0.0012414139 0.0013469887
#> log(DIS) dy/dx 0.0874827483 0.1090459544 0.0741915185
#> log(RAD) dy/dx 0.0205272789 0.0509964901 0.0499343944
#> TAX dy/dx 0.0001119854 0.0003214412 0.0003250673
#> PTRATIO dy/dx 0.0055558689 0.0122916354 0.0120607649
#> B dy/dx 0.0001051127 0.0002329224 0.0002402479
#> log(LSTAT) dy/dx 0.0219644525 0.0585181294 0.0642535271
#>
#> Simulated z-values:
#> Direct Indirect Total
#> CRIM dy/dx -7.4994841 -4.98634164 -6.2445379
#> ZN dy/dx 1.3849089 0.04677364 0.5812456
#> INDUS dy/dx -0.4125128 -0.17162017 -0.4202047
#> CHAS1 (F) -0.7071731 2.84563534 2.3889585
#> I(NOX^2) dy/dx -0.5333156 -3.10740906 -4.1779636
#> I(RM^2) dy/dx 7.1941457 0.13786078 2.2935518
#> AGE dy/dx -2.3725648 1.37545631 0.4301303
#> log(DIS) dy/dx -1.6251567 -1.60672404 -4.2778465
#> log(RAD) dy/dx 3.0681266 1.18607155 2.4725598
#> TAX dy/dx -4.1348241 0.80977399 -0.6237021
#> PTRATIO dy/dx -2.6987618 -1.34211706 -2.6110102
#> B dy/dx 4.9701783 -1.68363867 0.5422391
#> log(LSTAT) dy/dx -11.7603876 -1.90095740 -5.7514500
#>
#> Simulated p-values:
#> Direct Indirect Total
#> CRIM dy/dx 6.4171e-14 6.1533e-07 4.2505e-10
#> ZN dy/dx 0.1660803 0.9626936 0.5610750
#> INDUS dy/dx 0.6799636 0.8637361 0.6743359
#> CHAS1 (F) 0.4794589 0.0044323 0.0168962
#> I(NOX^2) dy/dx 0.5938151 0.0018874 2.9413e-05
#> I(RM^2) dy/dx 6.2861e-13 0.8903504 0.0218163
#> AGE dy/dx 0.0176651 0.1689900 0.6671008
#> log(DIS) dy/dx 0.1041292 0.1081149 1.8871e-05
#> log(RAD) dy/dx 0.0021541 0.2355940 0.0134149
#> TAX dy/dx 3.5523e-05 0.4180701 0.5328233
#> PTRATIO dy/dx 0.0069598 0.1795580 0.0090275
#> B dy/dx 6.6891e-07 0.0922515 0.5876538
#> log(LSTAT) dy/dx < 2.22e-16 0.0573076 8.8481e-09
#data(house, package="spData")
#lw <- spdep::nb2listw(LO_nb)
#form <- formula(log(price) ~ age + I(age^2) + I(age^3) + log(lotsize) +
# rooms + log(TLA) + beds + syear)
#lobj <- lagsarlm(form, house, lw, method="Matrix",
# control=list(fdHess=TRUE), trs=trMat)
#summary(lobj)
#loobj <- impacts(lobj, tr=trMat, R=1000)
#summary(loobj, zstats=TRUE, short=TRUE)
#lobj1 <- stsls(form, house, lw)
#loobj1 <- impacts(lobj1, tr=trMat, R=1000)
#summary(loobj1, zstats=TRUE, short=TRUE)
#mobj <- lagsarlm(form, house, lw, type="mixed",
# method="Matrix", control=list(fdHess=TRUE), trs=trMat)
#summary(mobj)
#moobj <- impacts(mobj, tr=trMat, R=1000)
#summary(moobj, zstats=TRUE, short=TRUE)
# }