help spreg postestimation                                    also see:  spreg  


spreg postestimation -- Postestimation tools for spreg


The following postestimation commands are available after spreg:

command description ------------------------------------------------------------------------- INCLUDE help post_estat INCLUDE help post_estimates INCLUDE help post_lincom INCLUDE help post_lrtest INCLUDE help post_nlcom predict predicted values INCLUDE help post_predictnl INCLUDE help post_test INCLUDE help post_testnl -------------------------------------------------------------------------

Syntax for predict

predict [type] newvar [if] [in] [, statistic]

statistic Description ------------------------------------------------------------------------- Main rform reduced-form predicted values; the default limited predictions based on a limited information set naive predictions based on the observed values of y xb linear prediction rftransform(real matrix T) user-provided (I-lambda*W)^(-1) -------------------------------------------------------------------------

Options for predict

+------+ ----+ Main +-------------------------------------------------------------

rform predicted values calculated from the reduced-form equation, y = (I-lambda*W)^(-1)*X*b.

limited predicted values based on the limited information set. This option is available only for a model with homoskedastically-distributed errors.

naive predicted values based on the observed values of y, lambda*W*y + X*b.

xb calculates the linear prediction X*b.

See Remarks below for a detailed explanation of the predict options.

rftransform() tells predict use the user-specified inverse of (I-lambda*W). The matrix T should reside in Mata memory. This option is available only with the reduced-form predictor.


The methods implemented in predict after spreg are documented in Drukker, Prucha, and Raciborski (2011) which can be downloaded from

Recall the spatial-autoregressive spatial-error (SARAR) model

y = lambda*W*y + X*b + u

u = rho*M*u + e

This model specifies a system of n simultaneous equations for the dependent variable y.

The predictor based on the reduced-form equation is obtained by solving the model for the endogenous variable y which gives (I-lambda*W)^(-1)*X*b for the SAR and SARAR models and X*b for the SARE model.

The limited information set predictor is described in Kalejian and Prucha (2007). Let

U = (I-rho*M)^(-1) * (I-rho*M')^(-1) Y = (I-lambda*W)^(-1) * (I-lambda*W')^(-1) E(w_i*y) = w_i * (I-lambda*W)^(-1) * X*b cov(u_i,w_i*y) = sigma^2 * w_i*Y*w_i' var(w_i*y) = sigma^2 * u_i*(I-lambda*W')^(-1)*w_i'

where w_i and u_i denote the ith row of W and U, respectively. The limited information set predictor for observation i is given by

cov(u_i,w_i*y) lambda*w_i*y + x_i*b + -------------- * [w_i*y - E(w_i*y)] var(w_i*y)

where x_i denotes the ith row of X. Because the formula involves the sigma^2 term, this predictor is available only for a model with homoskedastically-distributed errors.

The reduced-form predictor is based on the information set {X,W}. The limited information set predictor includes additionally the linear combination W*y, thus it is more efficient than the reduced-form predictor. Both predictors are unbiased predictors conditional on their information set.

The naive predictor is obtained by treating the values of y on the right-hand side as given, which results in the formula lambda*W*y + X*b for the SAR and SARAR models, and X*b for the SARE model. Note that this predictor is a special case of the limited information set predictor with cov(u_i,w_i*y) = 0, but this this is true only when lambda = rho = 0.

The naive predictor ignores the feedback that the neighboring observations may have on the value of y in a given observation. The reduced-form and limited information set predictors factor this feedback into the computations through the (I-lambda*W)^(-1)*X*b term. If you are interested in how a change to a covariate in an observation affects the entire system, you should use the reduced-form or the limited information set predictor.


Setup . use pollute . spmat use cobj using pollute.spmat . spreg ml pollution factories area, id(id) dlmat(cobj) elmat(cobj)

Obtain predicted values based on the reduced-form equation . predict y0

Increase factories in observation 50 by 1 and obtain a new set of predicted values . replace factories = factories+1 in 50 . predict y1

Compare the two sets of predicted values . gen deltay = abs(y1-y0) . count if deltay!=0

Note that a change in one observation resulted in a total of 25 changes.


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,

Kelejian H. H., and I. R. Prucha. 2007. The relative efficiencies of various predictors in spatial econometric models containing spatial lags. Regional Science and Urban Economics 37, 363-374.

Also see

Online: spreg, spivreg (if installed)