You are on page 1of 41

Introduction to Spatial Econometrics

Alfonso Flores-Lagunes1, 2
Workshop prepared for CEPS/INSTEAD July 9, 2012
1 State

University of New York at Binghamton for the Study of Labor (IZA)

2 Institute

1. Introduction Two Examples 2. Basic Concepts 3. SAL Model 4. SAE Model 5. SAL-SAE Model 6. Testing for Spatial Dependence 7. GMM 8. Software

2 / 41

1. What is spatial econometrics?


The set of econometrics models and methods that allow spatial dependence across observations. Spatial dependence refers to dependence over space, as well as cross-sectional dependence over some concept of distance (e.g., economic distance). Introduced by Paelinck and Klaassen (1979) and popularized by, among others, Anselin (1980). By now, spatial econometrics has been employed in almost all elds of economics, e.g., Agricultural, labor, public nance, environmental, industrial organization, development.

3 / 41

1.1 Strategic Interaction


Do U.S. states engage in strategic environmental policymaking? (Fredriksson and Millimet, 2002) Pollution control in the US is a combination of federal standards and state-level implementation and enforcement. Since pollution does not respect borders, it is possible that states act strategically in their implementation and enforcement. To analyze his question, we must account for the geographical location of US states.
The strategic interaction of two states is dierent if they are California and Arizona or if they are California and New York.

4 / 41

1.2 A Hedonic Housing Price Model


Suppose we are interested in estimating a hedonic housing price model Clearly, houses that share a common location will be aected by common geographic characteristics (e.g., proximity to a good such as a park; or to a bad such as a waste site or airport noise). If we have data on all the detailed information about location characteristics, then including that information will take care of such factors. To the extent that we cannot control for all location characteristics, there will be unobservables that vary over space and that will lead to ineciencies in our estimated model(s).
5 / 41

2. Basic Concepts
There are at least two approaches to spatial dependence. We will introduce the approach that consists on imposing structure to a model in order to specify the spatial dependence. This structure takes the form of (a) the specication of a spatial weighting matrix and (b) a spatial autocorrelation parameter to be estimated. This approach has been advocated and employed by, among others, L. Anselin, H. Kelejian, I. Prucha, L-f. Lee. Another approach nonparametrically estimates the spatial structure under certain conditions (e.g., Conley, 1999).

6 / 41

2. Basic Concepts

In general, the issue to take into account is the increased similarity or dissimilarity of units as they are closer to each other in space. cov (yi , yj ) = 0 for i = j that is stronger as i is closer to j. Similarity positive spatial correlation. Dissimilarity negative spatial correlation.

7 / 41

2. Basic Concepts
For a single cross-sectional sample, the problem is that spatial correlation implies the existence of a NxN variance-covariance matrix (VCM) of spatial correlations. That many correlation parameters cannot be estimated from a single cross-sectional sample. One solution: impose (assume) some structure on this VCM. Assume that for each unit there is a neighborhood of data within which spatial dependence arises. This solution implies setting this neighborhood up in the form of a spatial weighting matrix.

8 / 41

2. Basic Concepts
The spatial weighting matrix (W ) contains for each observation i (rows) the locations (columns) of the other observations that belong to the assumed neighborhood set of i . Thus, it is a NxN matrix. Notes:
It is typically specied by the researcher: this may be ad-hoc. It is typically row-standardized (each row adds up to 1) so that the interpretation is as an average of neighboring values. The diagonal is composed of zeroes. Examples of W : (a) neighbors that share a common border (rst-order contiguity), (b) neighbors within a given distance of each other. Importantly, W is not estimated.
9 / 41

3. The Spatial Autoregressive Lag (SAL) Model


Also known as mixed-regressive spatial autoregressive (MRSA) model or spatial autoregressive (SAR) model. y = Wy + X + , iid (0, 2 )

where is the SAL parameter with (1, 1), and Wy is the spatially lagged dependent variable. An issue with this model is endogeneity of Wy , as it is correlated with . As a consequence, OLS is inconsistent (an exception is in Lee, 2002).

10 / 41

3. SAL Model
The model can be written in the following reduced form: y Wy =X + y (I W ) =X + y =(I W )1 X + (I W )1 Also, note that: var [y ] =var [(I W )1 X ] + var [(I W )1 ] = (I W )1 var [](I W )1 = 2 (I W )1 (I W )1

11 / 41

3. SAL Model: Estimation


The SAL model can be estimated with maximum likelihood (MLE; Ord, 1975; formally Lee, 2007). Take the model in reduced form y = (I W )1 X + (I W )1 and assume that is normally distributed. Note that the transformation of into (I W )1 implies that the likelihood function will contain the following determinant: |I W |. This determinant is NxN and thus it is dicult to compute for large N .

12 / 41

3. SAL Model: Estimation


Ord (1975) showed that |I W | = N i =1 (1 i ) where i are the eigenvalues of W , which are somewhat easier to compute. Then, the log-likelihood function ( ) takes the form:.
N SAL

=
i =1

ln(1 i )

N N ln(2 ) ln( 2 ) 2 2

(y Wy X ) (y Wy X ) 2 2 which is max. with respect to , , and 2 .

13 / 41

3. SAL Model: Estimation


Notes: MLE is computationally expensive and potentially inaccurate for large N . There were no clear theoretical properties until Lee (2007) who showed the estimator has usual MLE properties. We will cover another estimation method in GMM. Typically, it is useful to use sparse matrices in programming, as W is typically sparse. Note that the marginal eects are no longer but instead (I W )1 (from the reduced form).

14 / 41

4. The Spatial Autoregressive Error (SAE) Model


Also known as spatial autoregressive error model (SARE) model or spatial error model (SEM). y = X + u, u = Wu + , iid (0, 2 )

where is the SAE parameter with (1, 1), and Wu is the spatially lagged error term. Note that in this model there is no endogeneity, as it was the case in SAL. However, the error is clearly non-spherical. As a consequence, OLS is inecient.

15 / 41

4. SAE Model
The model can be written in the following reduced form: Note : u (I W ) = = u = (I W )1 Thus : y =X + (I W )1

and E [uu ] =E [(I W )1 (I W )1 ] = 2 (I W )1 (I W )1 The VCM of the errors (last line) is a full matrix, with both heteroskedasticity and spatial correlation.
16 / 41

4. SAE Model
The SAL and SAE models are closely related (through non-linear constraints) and thus dicult to tell them apart in practice with statistical tests (more later). Thus, it is important to judiciously choose and carefully justify when choosing between the two. SAL is consistent with models of spillovers and strategic behavior in y . e.g., strategic competition as in example 1. SAE is consistent with spatial dependence arising from correlation in unobservables. e.g., natural heterogeneity over space as in example 2.

17 / 41

4. SAE Model: Estimation


The SAE model can be estimated with MLE. Take the model in reduced form and dene (I W )1 (I W )1 and assume that is normally distributed. Then the model can be seen as a GLS-type model with corresponding log-likelihood function: 1 N N ln || ln(2 ) ln( 2 ) SAE = 2 2 2 (y X ) 1 (y X ) 2 2 which is maximized with respect to , ,and 2 .

18 / 41

4. SAE Model: Estimation


Notes: The SAE implies repeatedly computing the determinants of an N by N matrix (). So MLE is computationally expensive as it was the case in SAL. When SAE is maximized, the resulting estimates have the MLE properties. Even though this is a GLS-type model, feasible-GLS (FGLS) is not straightforward since is not easily estimated with residuals (e.g., as it is in time series). FGLS was not available until Kelejian and Prucha (1999). Typically, it is useful to use sparse matrices in programming, as W is typically sparse.

19 / 41

5. SAL-SAE Model

Also known as SAC model or SAR-SARE model. It combines the previous two models. y = Wy + X + u , u = Mu + , iid (0, 2 )

with all the variables dened before and M another spatial weighting matrix. In general, W = M since in that case identication issues can arise (see, e.g., Anselin and Bera, 1998).

20 / 41

5. SAL-SAE Model
The model can be written in the following reduced form: y = (I W )1 X + (I W )1 (I M )1 and variances given by: E [uu ] = 2 (I M )1 (I M )1 var (y ) = 2 (I W )1 (I M )1 (I M )1 (I W )1 The VCM of the errors is a full matrix.

21 / 41

5. SAL-SAE Model: Estimation

The SAL-SAE model can be estimated with MLE. Note that the reduced form error is (I W )1 (I M )1 and assume that is normal. Then the log-likelihood function for SAL-SAE: N N 1 = ln |(I W )(I M )1 (I M )1 | ln(2 ) ln( 2 ) 2 2 2 (y Wy X ) [(I M )(I M )]1 (y Wy X ) 2 2 which is maximized with respect to , , ,and 2 .

22 / 41

6. Testing

Given the similarities in the models covered and the relative complexity in estimation, it is important to perform specication tests. The rst specication test, the Morans I, is a commonly used general test for the presence of any spatial dependence. It is for H0 : no spatial dependence and with no particular HA : in mind.

23 / 41

6. Testing for Spatial Dependence


The test statistic depends on whether W is row standardized. The expressions are as follows. The basis is e We ee which is standardized by its mean and variance: I (R ) = R R Tr (MX W ) N k Tr (MX WMX W ) + Tr (MX W )2 + [Tr (MX W )]2 Var [I (R )] =R 2 (N k )(N k + 2) 2 [E (I )] E [I (R )] =

24 / 41

6. Testing for Spatial Dependence


Then the test statistic becomes: I (R ) E [I (R )] N (0, 1) V [I (R )]1/2 where R = 1 if W is row-standardized or R = N /S if W is OLS , not row standardized, e = y X N 1 MX = (I PX ) = (I X (X X ) X ), S = N i =1 j =1 ij , ij are the elements of W , N is the sample size, and k the number of regressors.

25 / 41

6. Testing for Spatial Dependence

Notes about Moran Is test: It is simple to implement as it only requires OLS residuals and a plausible W. Since it is a general test, it is likely to have low power and does not point to any particular alternative. It has been extended to a large family of limited dependent variable (LDV) models (Kelejian and Prucha, 2001).

26 / 41

6. Testing for SAE


Several tests for H0 : = 0 are available based on MLE theory. For instance, a LR test comparing OLS ( = 0) with the SAE model; done in the usual way (LR 2 (1) ). As usual in MLE theory, the LM test only requires estimation under the null (OLS), which avoids estimation of the SEL model. The LM test takes the form: e We LM = 2
2

1 2 (1) Tr [(W + W )W ]

27 / 41

6. Testing for SAL

Implies H0 : = 0 and tests can be devised based on MLE theory. For example, a LM test that only requires estimation under the null (OLS) is: e Wy LM = 2
2

2 ) MX (WX ) + Tr [(W + W )W ] (WX 2

2 (1)

28 / 41

6. Other Tests

Note that the tests for SAE and SAL above implicitly assume that = 0 and = 0, respectively. If that assumption is not true, the test is not valid. Anselin (1988) proposed a LM test for H0 : = = 0 based on OLS residuals, by comparing to the SAL-SAE model. But a problem is that rejection does oer guidance about which one of SAE or SAL is present.

29 / 41

6. Other Tests
One can test for SAE once SAL has been allowed for, to help determine if SAL adequately accounts for spatial dependence (the reverse is not as straightforward). Idea is to estimate the SAL model and test H0 : = 0 with a LM test.
LM = e Me 2 1 {Tr [M . M + M M ] Tr [M . W (I W )1 + M W (I W )1 ]2 var ()} (1)
2

A drawback is that it requires computation of the SAL model.

30 / 41

6. Other Tests

Anselin, Bera, Florax and Yoon (1996) developed tests for SAE or SAL that only require OLS residuals and allow for local misspecication.
That is, they allow for small misspecication of values of () in testing for SAE (SAL). Based on the work by Bera and Yoon (1993). Details of expressions in ABFY (1996).

31 / 41

7. GMM
Thus far we have employed MLE theory for estimation and testing. The use of GMM for spatial models was pioneered mainly by H. Kelejian and I. Prucha in the late 1990s. While MLE bases estimation and inference on the likelihood function, GMM is based on moment conditions.
Take OLS as an example. You can obtain OLS estimates by minimizing the sum of squared residuals or maximizing the corresponding likelihood function. Or you can obtain them using the implied moment conditions: E [X e ] = 0. Using those moment conditions gives rise to a method-of moments estimator. GMM is obtained by setting a quadratic form on the moment conditions and minimizing it w.r. to the parameters.
32 / 41

7. The GMM Revolution


An inuential paper is Kelejian and Prucha (1999; KP). Start with the simple model u = Mu + , iid (0, 2 ) and assume for the moment that u is observed.
Model can be estimated with MLE ( and 2 ), but it is computationally expensive. KP (1999) showed that moments can also be employed, which results in a less computationally demanding algorithm. And when u is not observed (e.g., in case they are errors), a consistent estimator of u can be employed instead (e.g., residuals).

Importantly, this allows employing GLS-type procedures in estimation of SAE and SAL models!
33 / 41

7. KP (1999)
In the simple model above, we know that E [uu ] = () = 2 (I M )1 (I M )1 . We use the following notation in the expressions for the = MMu , u = MM u moments: u = Mu , u = Mu , u , with u an estimate of u . Also = M . Then, it is not hard to show that the following moments hold: 1 = 2 N 1 2 E = Tr (M M ) N N 1 E =0 N E
34 / 41

7. KP (1999)
Using these 3 moments we are able to estimate and 2 since . Thus, substituting them into the = u u and = u u moments we have
E (u u ) E (u u ) 1 E (u u + u u ) N
2 N 2 N 1 E (u u ) N 1 E (u u ) N 1 E (u u ) N 1 N

1 Tr (M M ) 2 2 0 2 2

1 N 1 N 1 N

E (u u ) E (u u ) E (u u )

2 by substituting sample and which can be used to obtain moments and using GMM or NLLS. Estimates are consistent and asymptotically normal (KP, 1999).

35 / 41

7. KP (1999)
The previous results can be applied to the SAE model: y = X + u , u = Mu + , and iid (0, 2 ). OLS is Recall that OLS is consistent, then u = y X consistent for u . Now FGLS can be applied as follows:
1. 2. 3. 4. OLS and u Do OLS and obtain . Use u to estimate using the KP moments. 2 (I ) = M )1 (I M )1 and u Obtain ( . 1 1 FGLS = [X ( )X ] X 1 ( )y . Obtain

Advantages: We avoid computationally intensive MLE .

36 / 41

7. Using IVs to Estimate the SAL Model


Recall that the problem in the SAL model is endogeneity of Wy : y = Wy + X + , iid (0, 2 ). What about using instrumental variables (IVs) instead of MLE?
The optimal IVs are E [Wy ] = WE [y ] = W (I W )1 X . But the optimal IVs depend on unknown ! One approximation to the optimal IVs (KP, 1998): i i E [y ] = W (I W )1 X ) = i =0 W X , if 0 || < 1 and with W = I . Thus, a practical approximation to the optimal IVs is the set of linearly independent columns of [X , WX , W 2 X , W 3 X , ...].

37 / 41

7. Using IVs to Estimate the SAL Model

Then, using those KP instruments we can employ TSLS:


1. Run Wy on the KP IVs and obtain Wy . TSLS . 2. Run y = Wy + X + to obtain TSLS and

38 / 41

7. Application to the SAL-SAE Model


Recall: Wy : y = Wy + X + u , u = u + , iid (0, 2 ). To avoid MLE, use a combination of the previous two methods: Generalized Spatial TSLS (GSTSLS) by KP (1998)
1. Use TSLS as in the previous slide to obtain u which is a consistent estimate of u . . 2. Use the KP moments to estimate : 3. Do TSLS in the following (Cochran-Orcutt-type) : transformed model that uses My ) = (Wy MWy ) + (X MX ) + or (y y () = Wy () + X () + . 4. Apply TSLS again using as KP IVs the extended set ). [X , WX , W 2 X , MX , MWX , MW 2 X ] to get Wy ( ) = Wy ( ) + X ( ) + to obtain 5. Run y ( GSTSLS and GSTSLS and GSTSLS .
39 / 41

8. Software
Two common programs for spatial econometrics analysis.
MATLAB has a spatial econometrics toolbox available, developed by J. LeSage: http://www.spatial-econometrics.com/ R has a spatial package available: http://r-spatial.sourceforge.net/ Both oer routines for many of the methods reviewed above (unfortunately, STATA does not have many spatial econometrics commands).

To conduct empirical work using spatial data it is a great advantage to have working knowledge of ArcGIS.

40 / 41

8. Active Areas of Research

Spatial Econometrics is a very active area of research.


Panel Data Models: e.g., Lee and Yu (2010), Baltagi (2005), Kapoor, Kelejian and Prucha (2007). Limited Dependent Variable Models: e.g., Pinkse and Slade (1998), Klier and McMillen (2008), LeSage and Pace (2009), Flores-Lagunes and Schnier (2012). Nonparametric and Semiparametric Models: e.g., McMillen and Redfearn (2010), McMillen (2010).

41 / 41

You might also like