Learn R Programming

spdep (version 0.4-9)

stsls: Generalized spatial two stage least squares

Description

The function fits a spatial lag model by two stage least squares, with the option of adjusting the results for heteroskedasticity.

Usage

stsls(formula, data = list(), listw, zero.policy = FALSE,
 na.action = na.fail, robust = FALSE)

Arguments

formula
a symbolic description of the model to be fit. The details of model specification are given for lm()
data
an optional data frame containing the variables in the model. By default the variables are taken from the environment which the function is called.
listw
a listw object created for example by nb2listw
zero.policy
if TRUE assign zero to the lagged value of zones without neighbours, if FALSE (default) assign NA - causing lagsarlm() to terminate with an error
na.action
a function (default na.fail), can also be na.omit or na.exclude with consequences for residuals and fitted values - in these cases the weights list will be subsetted to remove NAs in the data. It may be necessary to
robust
default FALSE, if TRUE, apply a heteroskedasticity correction to the coefficient estimatess and their covariances

Value

  • an object of class "stsls" containing:
  • coefficientscoefficient estimates
  • varcoefficient covariance matrix
  • ssesum of squared errors
  • residualsmodel residuals
  • dfdegrees of freedom

Details

The fitting implementation fits a spatial lag model:

$$y = \rho W y + X \beta + \varepsilon$$

by using spatially lagged X variables as instruments for the spatially lagged dependent variable.

References

Kelejian, H.H. and I.R. Prucha (1998). A generalized spatial two stage least squares procedure for estimating a spatial autoregressive model with autoregressive disturbances. Journal of Real Estate Finance and Economics 17, 99-121.

See Also

lagsarlm

Examples

Run this code
data(oldcol)
COL.lag.eig <- lagsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, nb2listw(COL.nb))
summary(COL.lag.eig, correlation=TRUE)
COL.lag.stsls <- stsls(CRIME ~ INC + HOVAL, data=COL.OLD, nb2listw(COL.nb))
summary(COL.lag.stsls, correlation=TRUE)
COL.lag.stslsR <- stsls(CRIME ~ INC + HOVAL, data=COL.OLD, nb2listw(COL.nb),
robust=TRUE)
summary(COL.lag.stslsR, correlation=TRUE)
data(boston)
gp2a <- stsls(log(CMEDV) ~ CRIM + ZN + INDUS + CHAS + I(NOX^2) + I(RM^2) +
  AGE + log(DIS) + log(RAD) + TAX + PTRATIO + B + log(LSTAT),
 data=boston.c, nb2listw(boston.soi))
summary(gp2a)

Run the code above in your browser using DataLab