spsurgs3sls {spsur} | R Documentation |
General Spatial 3SLS for systems of spatial equations.
Description
The function estimates spatial SUR models using general spatial three stages least squares. This is a system instrumental variable procedure which also include GMM estimation when there is spatial correlations in the errors. The procedure allows for additional endogenous regressors in addition to spatial lags of the dependent variable. It could be applied to "slm", "sdm", "sem" and "sarar" spatial models. Furthermore, for non-spatial models including endogenous regressors ("iv"), it could be used to estimate using instrumental variables and Feasible Generalized Least Squares.
Usage
spsurgs3sls(formula = NULL, data = NULL, na.action,
listw = NULL, zero.policy = NULL,
type = "slm", Durbin = FALSE,
endog = NULL, instruments = NULL,
lag.instr = FALSE, initial.value = 0.2,
het = FALSE, trace = TRUE)
Arguments
formula |
An object type |
data |
An object of class data.frame or a matrix. |
na.action |
A function (default |
listw |
A |
zero.policy |
Similar to the corresponding parameter of
|
type |
Type of spatial model specification: "sim", "iv", "slm", "sem", "sdm" or "sarar" . Default = "slm". |
Durbin |
If a formula object and model is type "sdm" the subset of explanatory variables to lag for each equation. |
endog |
Additional endogenous variables. Default NULL.
If not NULL should be specified as a
|
instruments |
external instruments. Default NULL. If not NULL should be specified as a formula with no dependent variable in the same way than previous endog argument. |
lag.instr |
should the external instruments be spatially lagged? |
initial.value |
he initial value for rho. It can be either numeric (default is 0.2) or set to 'SAR', in which case the optimization will start from the estimated coefficient of a regression of the 2SLS residuals over their spatial lag (i.e. a spatial AR model) |
het |
default FALSE: if TRUE uses the methods
developed for heteroskedasticity for each equation.
Wrapper using |
trace |
A logical value to show intermediate results during
the estimation process. Default = |
Details
spsurg3sls generalize the spreg
function
to multiequational spatial SUR models. The methodology to estimate
spatial SUR models by Generalized 3SLS follows the steps outlined in
Kelejian and Piras (pp. 304-305). The summary of the algorithm is
the next one:
Estimate each equation by 2SLS and obtain the estimated residuals
\hat{u}_j
for each equation.If the model includes a spatial lag for the errors. (that is, it is a SEM/SARAR model), apply GMM to obtain the spatial parameters
\hat{\lambda}_j
for the residuals in each equation. In this case thespreg
function is used as a wrapper for the GMM estimation. If the model does not include a spatial lag for the errors (that is, it is a "sim", "iv", "slm" or "sdm" model), then\hat{\lambda}_j = 0
Compute
\hat{v}_j = \hat{u}_j-\hat{\lambda}_j W \hat{u}_j
and the covariances
\hat{\sigma}_{i,j} = N^{-1}\hat{v}_i\hat{v}_j
. Build
\hat{Sigma}=\lbrace \hat{\sigma_{i,j}} \rbrace
Compute
y_j^* = y_j - \hat{\lambda}_j W y_j
and
X_j^* = X_j- \hat{\lambda}_j W X_j
Compute
\hat{X}_j^* = H_j(H_j^T H_j)^{-1} H_j^T X_j^*
where
H_j
is the matrix including all the instruments and the exogenous regressors for each equation. That is,\hat{X}_j^*
is the projection ofX_j^*
using the instruments matrixH_j
.Compute, in a multiequational way, the Feasible Generalized Least Squares estimation using the new variables
\hat{y}_j^*
,\hat{X}_j^*
and\hat{Sigma}
. This is the 3sls step.
Value
Object of spsur
class with the output of the three-stages
least-squares estimation of the specified spatial model.
A list with:
call | Matched call. |
type | Type of model specified. |
Durbin | Value of Durbin argument. |
coefficients | Estimated coefficients for the regressors. |
deltas | Estimated spatial coefficients. |
rest.se | Estimated standard errors for the estimates of
\beta coefficients. |
deltas.se | Estimated standard errors for the estimates of the spatial coefficients. |
resvar | Estimated covariance matrix for the estimates of beta's and spatial coefficients. |
R2 | Coefficient of determination for each equation, obtained as the squared of the correlation coefficient between the corresponding explained variable and its estimates. spsur3sls also shows a global coefficient of determination obtained, in the same manner, for the set of G equations. |
Sigma | Estimated covariance matrix for the residuals of the G equations. |
residuals | Residuals of the model. |
df.residuals | Degrees of freedom for the residuals. |
fitted.values | Estimated values for the dependent variables. |
G | Number of equations. |
N | Number of cross-sections or spatial units. |
Tm | Number of time periods. |
p | Number of regressors by equation (including intercepts). |
Y | If data is NULL, vector Y of the explained variables of the SUR model. |
X | If data is NULL, matrix X of the regressors of the SUR model. |
W | Spatial weighting matrix. |
zero.policy | Logical value of zero.policy . |
listw_style | Style of neighborhood matrix W . |
Author(s)
Fernando López | fernando.lopez@upct.es |
Román Mínguez | roman.minguez@uclm.es |
Jesús Mur | jmur@unizar.es |
References
Kelejian, H. H. and Piras, G. (2017). Spatial Econometrics. Academic Press.
Kelejian, H.H. and Prucha, I.R. (2010). Specification and Estimation of Spatial Autoregressive Models with Autoregressive and Heteroskedastic Disturbances. Journal of Econometrics, 157, pp. 53-67.
Kelejian, H.H. and Prucha, I.R. (1999). A Generalized Moments Estimator for the Autoregressive Parameter in a Spatial Model. International Economic Review, 40, pp. 509-533.
Kelejian, H.H. and Prucha, I.R. (1998). A Generalized Spatial Two Stage Least Square Procedure for Estimating a Spatial Autoregressive Model with Autoregressive Disturbances. Journal of Real Estate Finance and Economics, 17, pp. 99–121.
Minguez, R., Lopez, F.A. and Mur, J. (2022). spsur: An R Package for Dealing with Spatial Seemingly Unrelated Regression Models. Journal of Statistical Software, 104(11), 1–43. <doi:10.18637/jss.v104.i11>
Piras, G. (2010). sphet: Spatial Models with Heteroskedastic Innovations in R. Journal of Statistical Software, 35(1), pp. 1-21. https://www.jstatsoft.org/v35/i01/. -
See Also
spreg
,
spsur3sls
,
stsls
,
spsurml
Examples
#### Example 1: Spatial Phillips-Curve. Anselin (1988, p. 203)
rm(list = ls()) # Clean memory
data(spc)
lwspc <- spdep::mat2listw(Wspc, style = "W")
## No endogenous regressors
Tformula <- WAGE83 | WAGE81 ~ UN83 + NMR83 + SMSA | UN80 + NMR80 + SMSA
## Endogenous regressors and Instruments
Tformula2 <- WAGE83 | WAGE81 ~ NMR83 | NMR80
## Endogenous regressors: UN83 , UN80
## Instrumental variable: SMSA
## A IV model with endogenous regressors only in first equation
spciv <- spsurgs3sls(formula = Tformula2, data = spc,
type = "iv", listw = lwspc,
endog = ~ UN83 | .,
instruments = ~ SMSA | .)
summary(spciv)
print(spciv)
#########################################################################
## A SLM model with endogenous regressors
spcslm <- spsurgs3sls(formula = Tformula2, data = spc,
endog = ~ UN83 | .,
instruments = ~ SMSA |.,
type = "slm",
listw = lwspc)
summary(spcslm)
print(spcslm)
impacts_spcslm <- impactspsur(spcslm, listw = lwspc, R = 1000)
summary(impacts_spcslm[[1]], zstats = TRUE, short = TRUE)
summary(impacts_spcslm[[2]], zstats = TRUE, short = TRUE)
#########################################################################
## A SDM model with endogenous regressors
spcsdm <- spsurgs3sls(formula = Tformula2, data = spc,
endog = ~ UN83 | UN80,
instruments = ~ SMSA | SMSA,
type = "sdm", listw = lwspc,
Durbin = ~ NMR83 | NMR80)
summary(spcsdm)
## Durbin only in one equation
spcsdm2 <- spsurgs3sls(formula = Tformula2, data = spc,
endog = ~ UN83 | UN80,
instruments = ~ SMSA | SMSA,
type = "sdm", listw = lwspc,
Durbin = ~ NMR83 | .)
summary(spcsdm2)
#########################################################################
## A SEM model with endogenous regressors
spcsem <- spsurgs3sls(formula = Tformula2, data = spc,
endog = ~ UN83 | UN80,
instruments = ~ SMSA | SMSA,
type = "sem", listw = lwspc)
summary(spcsem)
print(spcsem)
#########################################################################
## A SARAR model with endogenous regressors
spcsarar <- spsurgs3sls(formula = Tformula2, data = spc,
endog = ~ UN83 | UN80,
instruments = ~ SMSA | SMSA,
type = "sarar", listw = lwspc)
summary(spcsarar)
print(spcsarar)
impacts_spcsarar <- impactspsur(spcsarar, listw = lwspc, R = 1000)
summary(impacts_spcsarar[[1]], zstats = TRUE, short = TRUE)
summary(impacts_spcsarar[[2]], zstats = TRUE, short = TRUE)