*! version 1.0.5 04jun2013
help spregalso see: spreg postestimation
spivreg
spmat

Title

spreg -- Spatial-autoregressive model with
spatial-autoregressive disturbances

Syntax

spreg estimator depvar [indepvars] [if] [in], id(varname) [options]

estimator description

ml maximum likelihood (ML)

gs2sls generalized spatial two-stage least squares (GS2SLS)

Model
* id(varname) ID variable

dlmat(name[, eig]) spmat object used in the
spatial-autoregressive term

elmat(name[, eig]) spmat object used in the
spatial-error term

noconstant suppress constant term

ML estimator
gridsearch(#) search for initial values

constraints(constraints) apply
specified linear constraints

GS2SLS estimator
heteroskedastic use the estimator that allows for
heteroskedastic disturbance terms

impower(q) use q powers of matrix W in forming the
instrument matrix H; default is 2

Maximization
maximize_options control the
maximization process; seldom used

* Required

Description

spreg estimates the parameters of a cross-sectional
spatial-autoregressive model with spatial-autoregressive disturbances which
is known as a SARAR model.

A SARAR model includes a weighted average of the dependent variable, known
as a spatial lag, as a right-hand-side variable and it allows the
disturbance term to depend on a weighted average of the disturbances
corresponding to other units. The weights may differ for each observation
and are frequently inversely related to the distance from the current
observation. These weights must be stored in a spatial-weighting matrix
created by spmat.

spreg estimates the parameters by either maximum likelihood (ML) or by
generalized spatial two-stage least squares (GS2SLS).

You can download Drukker, Prucha, and Raciborski (2011), which documents
this command, from
http://econweb.umd.edu/~prucha/Papers/WP_spreg_2011.pdf.

Options

Model

id(varname) specifies a numeric variable that contains a unique
identifier for each observation.

dlmat(name[, eig]) specifies an spmat object
that contains the spatial-weighting matrix W to be used in the
spatial-autoregressive term. eig forces the calculation of the
eigenvalues of W, even if the spmat object contains them.
The eig option is only allowed with the ml estimator.

elmat(name[, eig]) specifies an spmat object
that contains the spatial-weighting matrix M to be used in the
spatial-error term. eig forces the calculation of the eigenvalues
of {bf:M, even if the spmat object contains them. The eig option
is only allowed with the ml estimator.

noconstant suppresses the constant term in the model.

ML

gridsearch(#) specifies the fineness of the grid used in
searching for the initial values of the parameters lambda and rho
in the concentrated log likelihood. The allowed range is
[0.001,0.1] with 0.1 being the default.

constraints(constraints);
see [R] estimation options.

maximize_options:
difficult,
technique(algorithm_spec),
iterate(#),
[no]log,
trace,
gradient,
showstep,
hessian,
showtolerance,
tolerance(#), ltolerance(#),
nrtolerance(#), nonrtolerance,
from(init_specs); see [R] maximize. These options are seldom
used. from() takes precedence over gridsearch().

GS2SLS

heteroskedastic specifies that spreg use an estimator that
allows e to be heteroskedastically distributed over the observations.
By default, spreg uses an estimator that assumes homoskedasticity.

impower(q) specifies how many powers of the matrix W
to include in calculating the instrument matrix H.
Integers in the set {2, 3, ..., floor(sqrt(cols(W)))}
are allowed, with q = 2 being the default.

maximize_options:
iterate(#),
[no]log,
trace,
gradient,
showstep,
showtolerance,
tolerance(#), ltolerance(#); see [R] maximize.
These options are seldom used.
from(init_specs) is also allowed, but because rho is the only
parameter in the optimization problem, the initial value should be
specified as from(#).

Example

Setup

. use pollute, clear

. spmat use cobj using pollute.spmat, replace

Estimate the SARAR parameters by ML

. spreg ml pollution factories area, id(id) dlmat(cobj) elmat(cobj)

Estimate the SARAR parameters by GS2SLS

. spreg gs2sls pollution factories area, id(id) dlmat(cobj) elmat(cobj)

Saved results

spreg ml saves the following in e():

Scalars

e(N) number of observations

e(k) number of parameters

e(df_m) model degrees of freedom

e(rank) rank of e(V)

e(iterations) number of ML iterations

e(converged) 1 if converged, 0 otherwise

e(ll) log likelihood

e(chi2) chi-squared statistic

e(p) significance

Macros

e(cmdline) command as typed

e(cmd) spreg

e(estimator) ml

e(model) sarar, sar, sare, or lr

e(title) title in estimation output

e(depvar) name of dependent variable

e(indeps) names of independent variables

e(constant) noconstant or hasconstant

e(idvar) name of ID variable

e(dlmat) name of spmat object in dlmat()

e(elmat) name of spmat object in elmat()

e(chi2type) type of model chi-squared test

e(vce) oim

e(user) name of likelihood-evaluator program

e(crittype) type of optimization

e(technique) maximization technique

e(predict) program used to implement predict

e(estat_cmd) program used to implement estat

e(properties) b V

Matrices

e(b) coefficient vector

e(V) variance-covariance matrix of the estimators

e(Cns) constraints matrix

e(ilog) iteration log

e(gradient) gradient vector

Functions

e(sample) marks estimation sample

spreg gs2sls saves the following in e():

Scalars

e(N) number of observations

e(k) number of parameters

e(rho_2sls) initial estimate of rho

e(iterations) number of GMM iterations

e(iterations_2sls) number of 2SLS iterations

e(converged) 1 if GMM stage converged, 0 otherwise

e(converged_2sls) 1 if 2SLS stage converged, 0 otherwise

Macros

e(cmdline) command as typed

e(cmd) spreg

e(estimator) gs2sls

e(model) sarar, sar, sare, or lr

e(het) heteroskedastic or homoskedastic

e(title) title in estimation output

e(depvar) name of dependent variable

e(indeps) names of independent variables

e(exogr) exogenous regressors

e(constant) noconstant or hasconstant

e(H_omitted) names of omitted instruments in H

e(idvar) name of ID variable

e(dlmat) name of spmat object in dlmat()

e(elmat) name of spmat object in elmat()

e(predict) program used to implement predict

e(estat_cmd) program used to implement estat

e(properties) b V

Matrices

e(b) coefficient vector

e(V) variance-covariance matrix of the estimators

e(delta_2sls) initial estimate of lambda and b

Functions

e(sample) marks estimation sample

References

Drukker, D. M., I. R. Prucha, and R. Raciborski. 2011.
Maximum-likelihood and generalized spatial two-stage least-squares estimators
for a spatial-autoregressive model with spatial-autoregressive disturbances.
Working paper, University of Maryland, Department of Economics,
http://econweb.umd.edu/~prucha/Papers/WP_spreg_2011.pdf.

Authors

David Drukker, StataCorp, College Station, TX.
ddrukker@stata.com.

Ingmar Prucha, Department of Economics, University of Maryland, College Park, MD.
prucha@econ.umd.edu.

Rafal Raciborski, StataCorp, College Station, TX.
rraciborski@stata.com.

Acknowledgment

We gratefully acknowledge financial support from the National Institute of
Health through the SBIR grant R43 AG027622 and R44 AG027622.

Also see

Online: spmat, spivreg,
spmap, shp2dta, mif2dta (if installed)