impactspar {pspatreg} | R Documentation |
Compute direct, indirect and total impacts for continous parametric covariates.
Description
Compute direct, indirect and total impacts for parametric covariates included in a semiparametric spatial or spatio-temporal model. The models can be of type ps-sar, ps-sarar, ps-sdm, ps-sdem or ps-slx.
Usage
impactspar(obj, ..., tr = NULL, R = 1000, listw = NULL, tol = 1e-06, Q = NULL)
Arguments
obj |
A 'pspatreg' 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 |
If |
tol |
Argument passed to |
Q |
default NULL, else an integer number of cumulative power series impacts to calculate if |
Details
This function is similar to the
impacts
method used in spatialreg.
package. The function
impactspar
obtains the three type of impacts (total, direct
and indirect) together with a measure of statistical
significance, according to the randomization approach described in
LeSage and Pace (2009). Briefly, they suggest to obtain a
sequence of nsim random matrices using a multivariate normal
distribution N(0; Sigma), being Sigma the estimated
covariance matrix of the fitted beta for parametric covariates
and spatial parameters of the model.
These random matrices, combined with the values of the fitted
beta for parametric covariates and the estimated
values of the spatial parameters, are used to obtain simulated values.
The function impactspar
obtains the standard
deviations using the nsim simulated impacts in the randomization
procedure, which are used to test the significance of the estimated
impacts for the original data.
Finally, if the spatial model is type = "slx" or "sdem", then there is no
need to simulate to make inference of the impacts. The standard errors of the
impacts are computed directly using the Sigma matrix of the estimated
covariances of beta and spatial parameters.
Value
An object of class impactspar.pspatreg. Can be printed
with summary
.
If type = "sar", "sdm", "sarar"
, the object returned is a list
with 4 objects including the type of model and three matrices including the simulated
total, direct and indirect impacts:
type | Type of spatial econometric model. |
mimpactstot | Matrix including simulated total impacts for each variable in rows. |
mimpactsdir | Matrix including simulated direct impacts for each variable in rows. |
mimpactsind | Matrix including simulated indirect impacts for each variable in rows. |
If type = "slx", "sdem"
the object returned is a list
with 5 objects including the type of model and four matrices including
the computed total, direct and indirect impacts, the standard errors,
the z-values and p-values of each type of impact:
type | Type of spatial econometric model. |
mimpact | Matrix including computed total, direct and indirect impacts for each variable in rows. |
semimpact | Matrix including standard errors of total, direct and indirect impacts for each variable in rows. |
zvalmimpact | Matrix including z-values of total, direct and indirect impacts for each variable in rows. |
pvalmimpact | Matrix including p-values of total, direct and indirect impacts for each variable in rows. |
References
LeSage, J. and Pace, K. (2009). Introduction to Spatial Econometrics. CRC Press, Boca Raton.
See Also
-
pspatfit
estimate spatial or spatio-temporal semiparametric ps-sar, ps-sem, ps-sarar, ps-slx or ps-durbin regression models. -
impactsnopar
compute total, direct and indirect impact functions for non-parametric continuous covariates. -
fit_terms
compute smooth term functions for non-parametric continuous covariates. -
impacts
similar function in spdep package to compute impacts in spatial parametric econometric models.
Examples
################################################
#### Examples using a panel data of rate of
##### unemployment for 103 Italian provinces in period 1996-2014.
library(pspatreg)
data(unemp_it, package = "pspatreg")
## Wsp_it is a matrix. Create a neighboord list
lwsp_it <- spdep::mat2listw(Wsp_it)
## short sample for spatial pure case (2d)
######## No Spatial Trend: PSAR including a spatial
######## lag of the dependent variable
form1 <- unrate ~ partrate + agri + cons + empgrowth +
pspl(serv, nknots = 15)
### example with type = "sar"
gamsar <- pspatfit(form1,
data = unemp_it,
type = "sar",
listw = lwsp_it)
summary(gamsar)
###### Parametric Total, Direct and Indirect Effects
imp_parvar <- impactspar(gamsar, listw = lwsp_it)
summary(imp_parvar)
### example with type = "slx"
gamslx <- pspatfit(form1,
data = unemp_it,
type = "slx",
listw = lwsp_it)
summary(gamslx)
###### Parametric Total, Direct and Indirect Effects
imp_parvarslx <- impactspar(gamslx, listw = lwsp_it)
summary(imp_parvarslx)