spsurgs3sls function

General Spatial 3SLS for systems of spatial equations.

General Spatial 3SLS for systems of spatial equations.

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.

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 Formula

    similar to objects created with the package Formula

    describing the equations to be estimated in the model. This model may contain several responses (explained variables) and a varying number of regressors in each equation.

  • data: An object of class data.frame or a matrix.

  • na.action: A function (default options("na.action")), can also be na.omit or na.exclude with consequences for residuals and fitted values. It may be necessary to set zero.policy to TRUE because this subsetting may create no-neighbour observations.

  • listw: A listw object created for example by nb2listw from spatialreg package; if nb2listw not given, set to the same spatial weights as the listw argument. It can also be a spatial weighting matrix of order (NxN) instead of a listw object. Default = NULL.

  • zero.policy: Similar to the corresponding parameter of lagsarlm function in spatialreg package. (NxN) instead of a listw object. Default = NULL.

  • 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 Formula with no dependent variable. Examples: ~ x1 | x2 (x1 endogeous regressor for the first equation and x2 endogeneous regressor for the second equation) or ~ x1 | . (x1 endogenous regressor for the first equation and none endogenous regressors for the second equation)

  • 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 spreg function.

  • trace: A logical value to show intermediate results during the estimation process. Default = TRUE.

Returns

Object of spsur class with the output of the three-stages least-squares estimation of the specified spatial model. A list with:

callMatched call.
typeType of model specified.
DurbinValue of Durbin argument.
coefficientsEstimated coefficients for the regressors.
deltasEstimated spatial coefficients.
rest.seEstimated standard errors for the estimates of β\beta coefficients.
deltas.seEstimated standard errors for the estimates of the spatial coefficients.
resvarEstimated covariance matrix for the estimates of beta's and spatial coefficients.
R2Coefficient 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.
SigmaEstimated covariance matrix for the residuals of the G equations.
residualsResiduals of the model.
df.residualsDegrees of freedom for the residuals.
fitted.valuesEstimated values for the dependent variables.
GNumber of equations.
NNumber of cross-sections or spatial units.
TmNumber of time periods.
pNumber of regressors by equation (including intercepts).
YIf data is NULL , vector Y of the explained variables of the SUR model.
XIf data is NULL , matrix X of the regressors of the SUR model.
WSpatial weighting matrix.
zero.policyLogical value of zero.policy .
listw_styleStyle of neighborhood matrix W .

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 u^j\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 λ^j\hat{\lambda}_j for the residuals in each equation. In this case the spreg

    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 λ^j=0\hat{\lambda}_j = 0

  • Compute

v^j=u^jλ^jWu^j \hat{v}_j = \hat{u}_j-\hat{\lambda}_j W \hat{u}_j

and the covariances

σ^i,j=N1v^iv^j \hat{\sigma}_{i,j} = N^{-1}\hat{v}_i\hat{v}_j

. Build Sigma^={σi,j^}\hat{Sigma}=\lbrace \hat{\sigma_{i,j}} \rbrace

  • Compute
yj=yjλ^jWyj y_j^* = y_j - \hat{\lambda}_j W y_j

and

Xj=Xjλ^jWXj X_j^* = X_j- \hat{\lambda}_j W X_j

Compute

X^j=Hj(HjTHj)1HjTXj \hat{X}_j^* = H_j(H_j^T H_j)^{-1} H_j^T X_j^*

where HjH_j is the matrix including all the instruments and the exogenous regressors for each equation. That is, X^j\hat{X}_j^*

is the projection of XjX_j^* using the instruments matrix HjH_j.

  • Compute, in a multiequational way, the Feasible Generalized Least Squares estimation using the new variables y^j\hat{y}_j^*, X^j\hat{X}_j^* and Sigma^\hat{Sigma}. This is the 3sls step.

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)

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

Author(s)

Fernando Lópezfernando.lopez@upct.es
Román Mínguezroman.minguez@uclm.es
Jesús Murjmur@unizar.es
  • Maintainer: Roman Minguez
  • License: GPL-3
  • Last published: 2022-10-29