lmtestspsur: Testing for the presence of spatial effects in Seemingly...

View source: R/lmtestspsur.R

lmtestspsurR Documentation

Testing for the presence of spatial effects in Seemingly Unrelated Regressions

Description

The function spsurml reports a collection of Lagrange Multipliers designed to test for the presence of different forms of spatial dependence in a SUR model of the "sim" type. That is, the approach of this function is from 'specific to general'. As said, the model of the null hypothesis is the "sim" model whereas the model of the alternative depends on the effect whose omission we want to test.

The collection of Lagrange Multipliers obtained by lmtestspsur are standard in the literature and take into account the multivariate nature of the SUR model. As a limitation, note that each Multiplier tests for the omission of the same spatial effects in all the cross-sections of the G equations.

Usage

lmtestspsur(...)

## S3 method for class 'formula'
lmtestspsur(
  formula,
  data,
  listw,
  na.action,
  time = NULL,
  Tm = 1,
  zero.policy = NULL,
  R = NULL,
  b = NULL,
  ...
)

## Default S3 method:
lmtestspsur(Y, X, G, N, Tm = 1, listw, p, R = NULL, b = NULL, ...)

Arguments

...

further arguments passed to the method.

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.

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.

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.

time

time index for the spatial panel SUR data.

Tm

Number of time periods.

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.

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.

Y

A column vector of order (NTmGx1), with the observations of the explained variables. The ordering of the data must be (first) equation, (second) time dimension and (third) cross-sectional/spatial units. The specification of Y is only necessary if not available a Formula and a data frame. Default = NULL.

X

A data matrix of order (NTmGxp) with the observations of the regressors. The number of covariates in the SUR model is p = sum(p_{g}) where p_{g} is the number of regressors (including the intercept) in the g-th equation, g = 1,...,G). The specification of "X" is only necessary if not available a Formula and a data frame. Default = NULL.

G

Number of equations.

N

Number of cross-section or spatial units

p

Number of regressors by equation, including the intercept. p can be a row vector of order (1xG), if the number of regressors is not the same for all the equations, or a scalar, if the G equations have the same number of regressors. The specification of p is only necessary if not available a Formula and a data frame.

Details

lmtestspsur tests for the omission of spatial effects in the "sim" version of the SUR model:

y_{tg} = X_{tg} β_{g} + u_{tg}

E[u_{tg}u_{th}']= σ_{gh}I_{N} \quad E[u_{tg}u_{sh}']= 0 \mbox{ if } t ne s

where y_{tg} and u_{tg} are (Nx1) vectors, corresponding to the g-th equation and time period t; X_{tg} is the matrix of exogenous variables, of order (Nxp_{g}). Moreover, β_{g} is an unknown (p_{g}x1) vector of coefficients and σ_{gh}I_{N} the covariance between equations g and h, being σ_{gh} and scalar and I_{N} the identity matrix of orden N.

The Lagrange Multipliers reported by this function are the followings:

  • LM-SUR-LAG: Tests for the omission of a spatial lag of the explained variable in the right hand side of the "sim" equation. The model of the alternative is:

    y_{tg} = ρ_{g}Wy_{tg} + X_{tg} β_{g} + u_{tg}

    The null and alternative hypotheses are:

    H_{0}: ρ_{g}=0 (forall g) vs H_{A}: ρ_{g} ne 0 (exist g)

  • LM-SUR-ERR: Tests for the omission of spatial dependence in the equation of the errors of the "sim" model. The model of the alternative is:

    y_{tg} = X_{tg} β_{g} + u_{tg}; u_{tg}= λ_{g}Wu_{tg}+ε_{tg}

    The null and alternative hypotheses are:

    H_{0}: λ_{g}=0 (forall g) vs H_{A}: λ_{g} ne 0 (exist g)

  • LM-SUR-SARAR: Tests for the simultaneous omission of a spatial lag of the explained variable in the right hand side of the "sim" equation and spatial dependence in the equation of the errors. The model of the alternative is:

    y_{tg} = ρ_{g}Wy_{tg}+X_{tg} β_{g} + u_{tg}; u_{tg}= λ_{g}Wu_{tg}+ε_{tg}

    The null and alternative hypotheses are:

    H_{0}: ρ_{g}=λ_{g}=0 (forall g) vs H_{A}: ρ_{g} ne 0 or λ_{g} ne 0 (exist g)

  • LM*-SUR-SLM and LM*-SUR-SEM: These two test are the robustifyed version of the original, raw Multipliers, LM-SUR-SLM and LM-SUR-SEM, which can be severely oversized if the respective alternative hypothesis is misspeficied (this would be the case if, for example, we are testing for omitted lags of the explained variable whereas the problem is that there is spatial dependence in the errors, or viceversa). The null and alternative hypotheses of both test are totally analogous to their twin non robust Multipliers.

Value

A list of htest objects each one including the Wald statistic, the corresponding p-value and the degrees of freedom.

Author(s)

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

References

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

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

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

  • Anselin, L. (1988) A test for spatial autocorrelation in seemingly unrelated regressions Economics Letters 28(4), 335-341. <doi:10.1016/0165-1765(88)90009-2>

  • Anselin, L. (1988) Spatial econometrics: methods and models Chap. 9 Dordrecht

  • Anselin, L. (2016) Estimation and Testing in the Spatial Seemingly Unrelated Regression (SUR). Geoda Center for Geospatial Analysis and Computation, Arizona State University. Working Paper 2016-01. <doi:10.13140/RG.2.2.15925.40163>

See Also

spsurml, anova

Examples

#################################################
######## CROSS SECTION DATA (G>1; Tm=1) # #######
#################################################

#### Example 1: Spatial Phillips-Curve. Anselin (1988, p. 203)
rm(list = ls()) # Clean memory
data("spc")
Tformula <- WAGE83 | WAGE81 ~ UN83 + NMR83 + SMSA | UN80 + NMR80 + SMSA
lwspc <- spdep::mat2listw(Wspc, style = "W")
lmtestspsur(formula = Tformula, data = spc, listw = lwspc)

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


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

#### Example 2: Homicides & Socio-Economics (1960-90)
# Homicides and selected socio-economic characteristics for
# continental U.S. counties.
# Data for four decennial census years: 1960, 1970, 1980 and 1990.
# https://geodacenter.github.io/data-and-lab/ncovr/
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)
### With different number of exogenous variables in each equation
Tformula <- HR70 | HR80  | HR90 ~ PS70 + UE70 | PS80 + UE80 +RD80 |
            PS90 + UE90 + RD90 + PO90
lmtestspsur(formula = Tformula, data = NCOVR.sf, 
            listw = lwncovr)

#################################################################
######### PANEL DATA: TEMPORAL CORRELATIONS (G=1; Tm>1) ########
#################################################################

##### Example 3: NCOVR in panel data form
Year <- as.numeric(kronecker(c(1960,1970,1980,1990), 
                   matrix(1,nrow = dim(NCOVR.sf)[1])))
HR <- c(NCOVR.sf$HR60,NCOVR.sf$HR70,NCOVR.sf$HR80,NCOVR.sf$HR90)
PS <- c(NCOVR.sf$PS60,NCOVR.sf$PS70,NCOVR.sf$PS80,NCOVR.sf$PS90)
UE <- c(NCOVR.sf$UE60,NCOVR.sf$UE70,NCOVR.sf$UE80,NCOVR.sf$UE90)
NCOVRpanel <- as.data.frame(cbind(Year,HR,PS,UE))
Tformula <- HR ~ PS + UE
lmtestspsur(formula = Tformula, data = NCOVRpanel, time = Year, 
listw = lwncovr)



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