spsurtime: Estimation of SUR models for simple spatial panels (G=1).

View source: R/spsurtime.R

spsurtimeR Documentation

Estimation of SUR models for simple spatial panels (G=1).

Description

This function estimates SUR models for simple spatial panel datasets. spsurtime is restricted, specifically, to cases where there is only one equation, G=1, and a varying number of spatial units, N, and time periods, Tm. The SUR structure appears in form of serial dependence among the error terms corresponding to the same spatial unit. Note that it is assumed that all spatial units share a common pattern of serial dependence.

The user can choose between different types of spatial specifications, as described below, and the estimation algorithms allow for the introduction of linear restrictions on the β parameters associated to the regressors. The spatial panels with SUR structure can be estimated by maximum-likelihood methods or three-stages least squares procedures, using spatial instrumental variables.

Usage

spsurtime (formula, data, time, na.action,
                  listw = NULL, type = "sim", Durbin = NULL, 
                  method = "eigen", fit_method = "ml", maxlagW = NULL,
                  zero.policy = NULL, interval = NULL, trs = NULL,
                  R = NULL, b = NULL, demean = FALSE, control = list() )

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.

time

Time variable.

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.

type

Type of spatial model specification: "sim", "slx", "slm", "sem", "sdm", "sdem", "sarar" or "gnm". Default = "sim".

Durbin

If a formula object and model is type "sdm", "sdem" or "slx" the subset of explanatory variables to lag for each equation.

method

Similar to the corresponding parameter of lagsarlm function in spatialreg package. "eigen" (default) - the Jacobian is computed as the product of (1 - rho*eigenvalue) using eigenw, and "spam" or "Matrix_J" for strictly symmetric weights lists of styles "B" and "C", or made symmetric by similarity (Ord, 1975, Appendix C) if possible for styles "W" and "S", using code from the spam or Matrix packages to calculate the determinant; "Matrix" and "spam_update" provide updating Cholesky decomposition methods; "LU" provides an alternative sparse matrix decomposition approach. In addition, there are "Chebyshev" and Monte Carlo "MC" approximate log-determinant methods; the Smirnov/Anselin (2009) trace approximation is available as "moments". Three methods: "SE_classic", "SE_whichMin", and "SE_interp" are provided experimentally, the first to attempt to emulate the behaviour of Spatial Econometrics toolbox ML fitting functions. All use grids of log determinant values, and the latter two attempt to ameliorate some features of "SE_classic".

fit_method

Method of estimation for the spatial panel SUR model, either ml or 3sls. Default = ml.

maxlagW

Maximum spatial lag order of the regressors employed to produce spatial instruments for the spatial lags of the explained variables. Default = 2. Note that in case of type = "sdm", the default value for maxlagW is set to 3 because the first lag of the regressors, WX_{tg}, can not be used as spatial instruments.

zero.policy

Similar to the corresponding parameter of lagsarlm function in spatialreg package. If TRUE assign zero to the lagged value of zones without neighbours, if FALSE assign NA - causing spsurml() to terminate with an error. Default = NULL.

interval

Search interval for autoregressive parameter. Default = NULL.

trs

Either NULL or vector of powered spatial weights matrix traces output by trW. Default = NULL.

R

A row vector of order (1xpr) with the set of r linear constraints on the beta parameters. The first restriction appears in the first p terms, the second restriction in the next p terms and so on. Default = NULL.

b

A column vector of order (rx1) with the values of the linear restrictions on the beta parameters. Default = NULL.

demean

Logical value to allow for the demeaning of panel data. In this case, spsurml subtracts the individual mean to each spatial or cross-sectional unit. Default = FALSE.

control

list of additional arguments.

Details

Function spsurtime only admits a formula, created with Formula and a dataset of class data.frame or matrix. That is, the data cannot be uploaded using data matrices Y and X provided for other functions in this package.
The argument time selects the variable, in the data.frame, associated to the time dimension in the panel dataset. Then spsurtime operates as in Anselin (1988), that is, each cross-section is treated as if it were an equation in a SUR model, which now has Tm 'equations' and N individuals.
The SUR structure appears because there is serial dependence in the errors of each individual in the panel. The serial dependence in the errors is not parameterized, but estimated non-parametrically in the Sigma covariance matrix returned by the function. An important constraint to mention is that the serial dependence assumed to be the same for all individuals in the sample. Serial dependence among individuals is excluded from Anselin approach.

Value

An spsur object with the output of the maximum-likelihood or three-stages least-squares estimation of the spatial panel SUR model.

Author(s)

Fernando Lopez fernando.lopez@upct.es
Roman Minguez roman.minguez@uclm.es
Jesus Mur jmur@unizar.es

References

  • Anselin, L. (1988). Spatial econometrics: methods and models. Dordrecht, Kluwer Academic Publishers.

  • Lopez, F.A., Mur, J., and Angulo, A. (2014). Spatial model selection strategies in a SUR framework. The case of regional productivity in EU. Annals of Regional Science, 53(1), 197-220. <doi:10.1007/s00168-014-0624-2>

  • Lopez, F.A., Martinez-Ortiz, P.J., and Cegarra-Navarro, J.G. (2017). Spatial spillovers in public expenditure on a municipal level in Spain. Annals of Regional Science, 58(1), 39-65. <doi:10.1007/s00168-016-0780-7>

  • 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>

  • Mur, J., Lopez, F., and Herrera, M. (2010). Testing for spatial effects in seemingly unrelated regressions. Spatial Economic Analysis, 5(4), 399-440. <doi:10.1080/17421772.2010.516443>

See Also

spsurml, spsur3sls, wald_betas, wald_deltas, lmtestspsur, lr_betas

Examples


####################################
######## PANEL DATA (G=1; Tm>1) ###
####################################

## Example 1:
rm(list = ls()) # Clean memory
data(spc)
lwspc <- spdep::mat2listw(Wspc, style = "W")
N <- nrow(spc)
Tm <- 2
index_time <- rep(1:Tm, each = N)
index_indiv <- rep(1:N, Tm)
WAGE <- c(spc$WAGE83, spc$WAGE81)
UN <- c(spc$UN83, spc$UN80)
NMR <- c(spc$NMR83, spc$NMR80)
SMSA <- c(spc$SMSA, spc$SMSA)
pspc <- data.frame(index_indiv, index_time, WAGE, UN,
                    NMR, SMSA)
form_pspc <- WAGE ~ UN + NMR + SMSA
form2_pspc <- WAGE | NMR ~ UN  | UN + SMSA

# SLM 
pspc_slm <- spsurtime(formula = form_pspc, data = pspc, 
                      listw = lwspc,
                      time = pspc$index_time, 
                      type = "slm", fit_method = "ml")
summary(pspc_slm)
 
pspc_slm2 <- spsurtime(formula = form2_pspc, data = pspc, 
                      listw = lwspc,
                      time = pspc$index_time, 
                      type = "slm", fit_method = "ml")
summary(pspc_slm2)


## VIP: The output of the whole set of the examples can be examined 
## by executing demo(demo_spsurtime, package="spsur")

 
### Example 2:
rm(list = ls()) # Clean memory
### Read NCOVR.sf object
data(NCOVR, package="spsur")
nbncovr <- spdep::poly2nb(NCOVR.sf, queen = TRUE)
### Some regions with no links...
lwncovr <- spdep::nb2listw(nbncovr, style = "W", zero.policy = TRUE)
N <- nrow(NCOVR.sf)
Tm <- 4
index_time <- rep(1:Tm, each = N)
index_indiv <- rep(1:N, Tm)
pHR <- c(NCOVR.sf$HR60, NCOVR.sf$HR70, NCOVR.sf$HR80, NCOVR.sf$HR90)
pPS <- c(NCOVR.sf$PS60, NCOVR.sf$PS70, NCOVR.sf$PS80, NCOVR.sf$PS90)
pUE <- c(NCOVR.sf$UE60, NCOVR.sf$UE70, NCOVR.sf$UE80, NCOVR.sf$UE90)
pNCOVR <- data.frame(indiv = index_indiv, time = index_time,
                     HR = pHR, PS = pPS, UE = pUE)
form_pHR <- HR ~ PS + UE

## SIM

pHR_sim <- spsurtime(formula = form_pHR, data = pNCOVR, 
                    time = pNCOVR$time, type = "sim", fit_method = "ml")
summary(pHR_sim)

## SLM by 3SLS. 

pHR_slm <- spsurtime(formula = form_pHR, data = pNCOVR, listw = lwncovr,
                     time = pNCOVR$time, type = "slm", 
                     fit_method = "3sls")
summary(pHR_slm)

############################# Wald tests about betas in spatio-temporal models
### H0: equal betas for PS in equations 1, 3 and 4.
R <- matrix(0, nrow = 2, ncol = 12) 
## nrow = number of restrictions 
## ncol = number of beta parameters
R[1, 2] <- 1; R[1, 8] <- -1 # PS beta coefficient in equations 1 equal to 3
R[2, 2] <- 1; R[2, 11] <- -1 # PS beta coefficient in equations 1 equal to 4
b <- matrix(0, nrow=2, ncol=1)
wald_betas(pHR_sim , R = R , b = b) # SIM model
wald_betas(pHR_slm , R = R , b = b) # SLM model
############################# Wald tests about spatial-parameters in
############################# spatio-temporal models
### H0: equal rhos in slm model for equations 1 and 2.
R2 <- matrix(0, nrow = 1, ncol = 4)
R2[1, 1] <- 1; R2[1, 2] <- -1
b2 <- matrix(0, nrow = 1, ncol = 1)
wald_deltas(pHR_slm, R = R2, b = b2)


spsur documentation built on Oct. 30, 2022, 1:06 a.m.