Analyzing spatial autoregressive models using Stata

Similar documents
A command for estimating spatial-autoregressive models with spatial-autoregressive disturbances and additional endogenous variables

Lecture 6: Hypothesis Testing

ESTIMATION PROBLEMS IN MODELS WITH SPATIAL WEIGHTING MATRICES WHICH HAVE BLOCKS OF EQUAL ELEMENTS*

splm: econometric analysis of spatial panel data

GMM Estimation of Spatial Error Autocorrelation with and without Heteroskedasticity

Spatial Regression Models: Identification strategy using STATA TATIANE MENEZES PIMES/UFPE

Lecture 3: Spatial Analysis with Stata

A SPATIAL CLIFF-ORD-TYPE MODEL WITH HETEROSKEDASTIC INNOVATIONS: SMALL AND LARGE SAMPLE RESULTS

Instrumental Variables/Method of

Comparing estimation methods. econometrics

Testing Random Effects in Two-Way Spatial Panel Data Models

xtdpdqml: Quasi-maximum likelihood estimation of linear dynamic short-t panel data models

A Spatial Cliff-Ord-type Model with Heteroskedastic Innovations: Small and Large Sample Results 1

Stata Implementation of the Non-Parametric Spatial Heteroskedasticity and Autocorrelation Consistent Covariance Matrix Estimator

Estimating Markov-switching regression models in Stata

1 Overview. 2 Data Files. 3 Estimation Programs

Generalized method of moments estimation in Stata 11

Outline. Overview of Issues. Spatial Regression. Luc Anselin

The exact bias of S 2 in linear panel regressions with spatial autocorrelation SFB 823. Discussion Paper. Christoph Hanck, Walter Krämer

GMM Estimation in Stata

Dynamic Panels. Chapter Introduction Autoregressive Model

Network data in regression framework

Testing for global spatial autocorrelation in Stata

ECON2228 Notes 10. Christopher F Baum. Boston College Economics. cfb (BC Econ) ECON2228 Notes / 48

Understanding the multinomial-poisson transformation

Lab 11 - Heteroskedasticity

ECON2228 Notes 10. Christopher F Baum. Boston College Economics. cfb (BC Econ) ECON2228 Notes / 54

PhD course: Spatial Health Econometrics. University of York, Monday 17 th July 2017

Econometrics. 8) Instrumental variables

Treatment interactions with nonexperimental data in Stata

Case of single exogenous (iv) variable (with single or multiple mediators) iv à med à dv. = β 0. iv i. med i + α 1

Introduction to Spatial Statistics and Modeling for Regional Analysis

David M. Drukker Italian Stata Users Group meeting 15 November Executive Director of Econometrics Stata

Instrumental Variables, Simultaneous and Systems of Equations

Spatial Regression. 10. Specification Tests (2) Luc Anselin. Copyright 2017 by Luc Anselin, All Rights Reserved

Introduction to Spatial Econometric Analysis: Creating spatially lagged variables in Stata

Bootstrap Test Statistics for Spatial Econometric Models

CHAPTER 3 APPLICATION OF MULTIVARIATE TECHNIQUE SPATIAL ANALYSIS ON RURAL POPULATION UNDER POVERTYLINE FROM OFFICIAL STATISTICS, THE WORLD BANK

Confidence intervals for the variance component of random-effects linear models

Econometrics. 9) Heteroscedasticity and autocorrelation

GMM Estimation of SAR Models with. Endogenous Regressors

Exploratory Spatial Data Analysis (ESDA)

Regional Science and Urban Economics

Lecture 7: Spatial Econometric Modeling of Origin-Destination flows

leebounds: Lee s (2009) treatment effects bounds for non-random sample selection for Stata

Dealing With and Understanding Endogeneity

1 Estimation of Persistent Dynamic Panel Data. Motivation

Introduction to Markov-switching regression models using the mswitch command

Monday 7 th Febraury 2005

W-BASED VS LATENT VARIABLES SPATIAL AUTOREGRESSIVE MODELS: EVIDENCE FROM MONTE CARLO SIMULATIONS

Regional Research Institute

Urban GIS for Health Metrics

SPATIAL ECONOMETRICS: METHODS AND MODELS

10) Time series econometrics

Longitudinal Data Analysis Using Stata Paul D. Allison, Ph.D. Upcoming Seminar: May 18-19, 2017, Chicago, Illinois

Spatial Regression. 11. Spatial Two Stage Least Squares. Luc Anselin. Copyright 2017 by Luc Anselin, All Rights Reserved

Chapter 11. Regression with a Binary Dependent Variable

-redprob- A Stata program for the Heckman estimator of the random effects dynamic probit model

Model and Working Correlation Structure Selection in GEE Analyses of Longitudinal Data

Journal of Statistical Software

Recent Developments in Multilevel Modeling

Dynamic Panel Data Models

Luc Anselin Spatial Analysis Laboratory Dept. Agricultural and Consumer Economics University of Illinois, Urbana-Champaign

Econometrics II Censoring & Truncation. May 5, 2011

One-stage dose-response meta-analysis

Finite sample properties of estimators of spatial autoregressive models with autoregressive disturbances

Airport Noise in Atlanta: Economic Consequences and Determinants. Jeffrey P. Cohen, Ph.D. Associate Professor of Economics. University of Hartford

Warwick Economics Summer School Topics in Microeconometrics Instrumental Variables Estimation

Big Value from Big Data: SAS/ETS Methods for Spatial Econometric Modeling in the Era of Big Data

Lecture 4: Maximum Likelihood Estimator of SLM and SEM

Lab 07 Introduction to Econometrics

A Journey to Latent Class Analysis (LCA)

GMM Estimation of the Spatial Autoregressive Model in a System of Interrelated Networks

fhetprob: A fast QMLE Stata routine for fractional probit models with multiplicative heteroskedasticity

Spatial Analysis 2. Spatial Autocorrelation

1 Outline. 1. Motivation. 2. SUR model. 3. Simultaneous equations. 4. Estimation

ARIC Manuscript Proposal # PC Reviewed: _9/_25_/06 Status: A Priority: _2 SC Reviewed: _9/_25_/06 Status: A Priority: _2

Lecture 3: Exploratory Spatial Data Analysis (ESDA) Prof. Eduardo A. Haddad

Autoregressive and Moving-Average Models

SPACE Workshop NSF NCGIA CSISS UCGIS SDSU. Aldstadt, Getis, Jankowski, Rey, Weeks SDSU F. Goodchild, M. Goodchild, Janelle, Rebich UCSB

multilevel modeling: concepts, applications and interpretations

Spatial Econometrics

Luc Anselin and Nancy Lozano-Gracia

Using generalized structural equation models to fit customized models without programming, and taking advantage of new features of -margins-

Stata tip 63: Modeling proportions

Simultaneous Equations with Error Components. Mike Bronner Marko Ledic Anja Breitwieser

Lecture 5: Spatial probit models. James P. LeSage University of Toledo Department of Economics Toledo, OH

4. MA(2) +drift: y t = µ + ɛ t + θ 1 ɛ t 1 + θ 2 ɛ t 2. Mean: where θ(l) = 1 + θ 1 L + θ 2 L 2. Therefore,

Working Paper No Introduction to Spatial Econometric Modelling. William Mitchell 1. April 2013

Day 2A Instrumental Variables, Two-stage Least Squares and Generalized Method of Moments

1 The basics of panel data

Variables and Variable De nitions

Paddy Availability Modeling in Indonesia Using Spatial Regression

Review on Spatial Data

Finding Hot Spots in ArcGIS Online: Minimizing the Subjectivity of Visual Analysis. Nicholas M. Giner Esri Parrish S.

Lab 3: Two levels Poisson models (taken from Multilevel and Longitudinal Modeling Using Stata, p )

Applied Spatial Econometrics. Professor Bernard Fingleton Director of Research Department of Land Economy University of Cambridge

Spatial Effects and Externalities

Lecture 3 Linear random intercept models

sphet: Spatial Models with Heteroskedastic Innovations in R

Transcription:

Analyzing spatial autoregressive models using Stata David M. Drukker StataCorp Summer North American Stata Users Group meeting July 24-25, 2008 Part of joint work with Ingmar Prucha and Harry Kelejian of the University of Maryland Funded in part by NIH grants 1 R43 AG027622-01 and 1 R43 AG027622-02. 1 / 30

Outline 1 What is spatial data and why is it special? 2 Managing spatial data 3 Spatial autoregressive models 2 / 30

What is spatial data and why is it special? What is spatial data? Spatial data contains information on the location of the observations, in addition to the values of the variables Property crimes per thousand households (48.585487,68.892044] (34.000835,48.585487] (20.048504,34.000835] [.178269,20.048504] Columbus, Ohio 1980 neighorhood data Source: Anselin (1988) 3 / 30

What is spatial data and why is it special? Correcting for Spatial Correlation 4 / 30 Correct for correlation in unobservable errors Efficiency and consistent standard errors Correct for outcome in place i depending on outcomes in nearby places Also known as state dependence or spill-over effects Correction required for consistent point estimates Correlation is more complicated than time-series case There is no natural ordering in space as there is in time Space has, at least, two dimensions instead of one Working on random fields complicates large-sample theory Models use a-priori parameterizations of distance Spatial-weighting matrices parameterize Tobler s first law of geography [Tobler(1970)] Everything is related to everything else, but near things are more related than distant things.

Managing spatial data Managing spatial data Much spatial data comes in the form of shapefiles US Census distributes shapefiles for the US at several resolutions as part of the TIGER project State level, zip-code level, and other resolutions are available Need to translate shapefile data to Stata data User-written (Crow and Gould ) shp2dta command Mapping spatial data Mauricio Pisati wrote spmap http://www.stata.com/support/faqs/graphics/spmap.html gives a great example of how to translate shapefiles and map data Need to create spatial-weighting matrices that parameterize distance 5 / 30

Shapefiles Managing spatial data Much spatial data comes in the form of ESRI shapefiles Environmental Systems Research Institute (ESRI), Inc. (http://www.esri.com/) make geographic information system (GIS) software The ESRI format for spatial data is widely used The format uses three files The.shp and the.shx files contain the map information The.dbf information contains observations on each mapped entity shp2dta translates ESRI shapefiles to Stata format Some data is distributed in the MapInfo Interchange Format User-written command (Crow and Gould) mif2dta translates MapInfo files to Stata format 6 / 30

Managing spatial data The Columbus dataset 7 / 30 [Anselin(1988)] used a dataset containing information on property crimes in 49 neighborhoods in Columubus, Ohio in 1980 Anselin now distributes a version of this dataset in ESRI shapefiles over the web There are three files columbus.shp, columbus.shx, and columbus.dbf in the current working directory To translate this data to Stata I used. shp2dta using columbus, database(columbusdb) coordinates(columbuscoor) /// > genid(id) replace The above command created columbusdb.dta and columbuscoor.dta columbusdb.dta contains neighborhood-level data columbuscoor.dta contains the coordinates for the neighborhoods in the form required spmap the user-written command by Maurizio Pisati See also http://econpapers.repec.org/software/bocbocode/s456812.htm

Managing spatial data Columbus data part II. use columbusdb, clear. describe id crime hoval inc storage display value variable name type format label variable label id byte %12.0g neighorhood id crime double %10.0g residential burglaries and vehicle thefts per 1000 households hoval double %10.0g housing value (in $1,000) inc double %10.0g household income (in $1,000). list id crime hoval inc in 1/5 id crime hoval inc 1. 1 15.72598 80.467003 19.531 2. 2 18.801754 44.567001 21.232 3. 3 30.626781 26.35 15.956 4. 4 32.38776 33.200001 4.477 5. 5 50.73151 23.225 11.252 8 / 30

Managing spatial data Visualizing spatial data spmap is an outstanding user-written command for exploring spatial data. spmap crime using columbuscoor, id(id) legend(size(medium) /// > position(11)) fcolor(blues) /// > title("property crimes per thousand households") /// > note("columbus, Ohio 1980 neighorhood data" "Source: Anselin (1988)") Property crimes per thousand households (48.585487,68.892044] (34.000835,48.585487] (20.048504,34.000835] [.178269,20.048504] Columbus, Ohio 1980 neighorhood data Source: Anselin (1988) 9 / 30

Modeling spatial data Cliff-Ord type models used in many social-sciences So named for [Cliff and Ord(1973), Cliff and Ord(1981), Ord(1975)] The model is given by where y = λwy + Xβ + u u = ρmu + ǫ y is the N 1 vector of observations on the dependent variable X is the N k matrix of observations on the independent variables W and M are N N spatial-weighting matrices that parameterize the distance between neighborhoods u are spatially correlated residuals and ǫ are independent and identically distributed disturbances λ and ρ are scalars that measure, respectively, the dependence of y i on nearby y and the spatial correlation in the errors 10 / 30

Cliff-Ord models II y = λwy + Xβ + u u = ρmu + ǫ Relatively simple, tractable model Allows for correlation among unobservables Each u i depends on a weighted average of other observations in u Mu is known as a spatial lag of u Allows for y i to depend on nearby y Each y i depends on a weighted average of other observations in y Wy is known as a spatial lag of y Growing amount of statistical theory for variations of this model 11 / 30

Spatial-weighting matrices Spatial-weighting matrices parameterize Tobler s first law of geography [Tobler(1970)] Everything is related to everything else, but near things are more related than distant things. Inverse-distance matrices and contiguity matrices are common parameterizations for the spatial-weighting matrix In an inverse-distance matrix W, w ij = 1/D(i, j) where D(i, j) is the distance between places i and j In a contiguity matrix W, { di,j if i and j are neighbors w i,j = 0 otherwise where d i,j is a weight 12 / 30

Spatial-weighting matrices parameterize dependence The spatial-weighting matrices parameterize the spatial dependence, up to estimable scalars If there is too much dependence, existing statistical theory is not applicable Older literature used a version of stationarity, newer literature uses easier to interpret restrictions on W and M The row and column sums must be finite, as the number of places grows to infinity Restricting the number of neighbors that affect any given place reduces dependence Restricting the extent to which neighbors affect any given place reduces dependence 13 / 30

Spatial-weighting matrices parameterize dependence II Contiguity matrices only allow contiguous neighbors to affect each other This structure naturally yields spatial-weighting matrices with limited dependence Inverse-distance matrices sometimes allow for all places to affect each other These matrices are normalized to limit dependence Sometimes places outside a given radius are specified to have zero affect, which naturally limits dependence 14 / 30

Normalizing spatial-weighting matrices In practice, inverse-distance spatial-weighting matrices are usually normalized Row normalized, W has element w i,j = (1/ N j=1 w i,j )w i,j Minmax normalized, W has element w i,j = (1/f )w i,j where f is min(s r, s c ) and s r is the largest row sum and s c is the largest column sum of W Spectral normalized, W has element w i,j = (1/ v )w i,j where v is the modulus of the largest eigenvalue of W 15 / 30

Creating and Managing spatial weighting matrices in Stata There is a forthcoming user-written command by David Drukker called spmat for creating spatial weighting matrices spmat uses variables in the dataset to create a spatial-weighting matrix spmat can create inverse-distance spatial-weighting matrices and contiguity spatial-weighting matrices spmat can also save spatial-weighting matrices to disk and read them in again spmat can also import spatial-weighting matrices from text files In the examples below, we create a contiguity matrix and two inverse-distance matrices that differ only in the normalization. spmat contiguity idmat_c using columbuscoor, p(id). spmat idistance idmat_row, p(id) pinformation(x y) normalize(row). spmat idistance idmat_mmax, p(id) pinformation(x y) normalize(spectral) 16 / 30

Some underlying statistical theory Recall the model y = λwy + Xβ + u u = ρmu + ǫ The model specifies that a set of N simultaneous equations for y and for u Two identification assumptions require that we can solve for u and y Solving for u yields u = (I ρm) 1 ǫ If ǫ is IID with finite variance σ 2, the spatial correlation among the errors is given by Ω u = E[uu ] = σ 2 (I ρm) 1 (I ρm ) 1 17 / 30

Some underlying statistical theory II Solving for y yields y = (I λw) 1 Xβ + (I λw) 1 (I ρm) 1 ǫ Wy is not an exogenous variable Using the above solution for y we can see that E[(Wy)u ] = W(I λw) 1 Ω u 0 18 / 30

Maximum likelihood estimator The above solution for y permits the derivation of the log-likelihood function In practice, we use the concentrated log-likelihood function ln L 2(λ, ρ) = n ( ln(2π) + 1 + ln σ 2 (λ, ρ) ) + ln I λw + ln I ρm 2 where σ 2 (λ, ρ) = 1 [ n y (λ, ρ) I X (ρ)[x (ρ) X (ρ)] 1 X (ρ) ] y (λ, ρ) y (λ) y (λ, ρ) = X (ρ) = (I λw)y, (I ρm)y (λ) = (I ρm)(i λw)y, = (I ρm)x, 19 / 30 Pluggin the values ˆλ and ˆρ that maximize the above concentrated log-likelihood function into equation σ 2 (λ,ρ) produces the ML estimate of σ 2.

Maximum likelihood estimator II Pluggin the values ˆλ and ˆρ that maximize the above concentrated log-likelihood function into β(λ,ρ) = [ X (ρ) X (ρ) ] 1 X (ρ) y (λ,ρ) produces the ML estimate of β. 20 / 30

Maximum likelihood estimator III Three types problems remain Numerical Lack of general statistical theory Quasi-maximum likelihood theory does not apply 21 / 30

Numerical problems with ML estimator The ML estimator requires computing the determinants I λw and I ρm for each iteration [Ord(1975)] showed I ρw = n i=1 (1 ρv i) where (v 1,v 2,...,v n ) are the eigenvalues of W This reduces, but does not remove, the problem For instance, with zip-code-level data, this would require obtaining the eigenvalues of a 32,000 by 32,000 square matrix 22 / 30

Lack of general statistical theory There is still no large-sample theory for the distribution of the ML for the Cliff-Ord model Special cases covered by [Lee(2004)] Allows for spatially correlated errors, but no spatially lagged dependent variable This estimator is frequently used, even though there is no large-sample theory for the distribution of the estimator 23 / 30

Quasi-maximum likelihood theory does not apply Simple deviations from Normal IID can cause the ML estimator to produce inconsistent estimates Arraiz, Drukker, Kelejian and Prucha (2008) provide simulation evidence showing that the ML estimator produces inconsistent estimates when the errors are heteroskedastic 24 / 30

sarml command Forthcoming user-written Stata command sarml estimates the parameters of Cliff-Ord models by ML. sarml crime hoval inc, armat(idmat_c) ecmat(idmat_c) nolog Spatial autoregressive model Number of obs = 49 (Maximum likelihood estimates) Wald chi2(2) = 43.6207 Prob > chi2 = 0.0000 Coef. Std. Err. z P> z [95% Conf. Interval] crime hoval -.2806984.0972479-2.89 0.004 -.4713008 -.090096 inc -1.201205.3363972-3.57 0.000-1.860532 -.5418786 _cons 56.79677 6.19428 9.17 0.000 44.6562 68.93733 lambda _cons.042729.0286644 1.49 0.136 -.0134522.0989103 rho sigma _cons.0639603.0768638 0.83 0.405 -.0866899.2146105 _cons 9.78293 1.005501 9.73 0.000 7.812185 11.75367 25 / 30. estimates store sarml

Generalized spatial Two-stage least squares (GS2SLS) Kelejian and Prucha [Kelejian and Prucha(1999), Kelejian and Prucha(1998), Kelejian and Prucha(2004)] along with coauthors [Arraiz et al.(2008)arraiz, Drukker, Kelejian, and Prucha] derived an estimator that uses instrumental variables and the generalized-method-of-moments (GMM) to estimate the parameters of cross-sectional Cliff-Ord models [Arraiz et al.(2008)arraiz, Drukker, Kelejian, and Prucha] show that the estimator produces consistent estimates when the disturbances are heteroskedastic and give simulation evidence that the ML estimator produces inconsistent estimates in the case 26 / 30

GS2SLS II Spatial autoregressive models The estimator is produced in three steps 1 Consistent estimates of β and λ are obtained by instrumental variables Following [Kelejian and Prucha(1998)] X,WX,W 2 X,... MX,MWX,MW 2 X,... are valid instruments, 2 Estimate ρ and σ by GMM using sample constructed from functions of the residuals The moment conditions explicitly allow for heteroskedastic innovations. 3 Use the estimates of ρ and σ to perform a spatial Cochrane-Orcut transformation of the data and obtain more efficient estimates of β and λ The authors derive the joint large-sample distribution of the estimators 27 / 30

g2sls command Forthcoming user-written command g2sls implements the [Arraiz et al.(2008)arraiz, Drukker, Kelejian, and Prucha] estimator. gs2sls crime hoval inc, armat(idmat_c) ecmat(idmat_c) nolog GS2SL regression Number of obs = 49 Coef. Std. Err. z P> z [95% Conf. Interval] crime hoval -.2561395.1621328-1.58 0.114 -.573914.061635 inc -1.186221.5223525-2.27 0.023-2.210013 -.1624286 _cons 52.28828 9.441074 5.54 0.000 33.78411 70.79244 lambda _cons.0651557.0273606 2.38 0.017.0115299.1187816 rho _cons.0224828.0801967 0.28 0.779 -.1346998.1796654. estimates store gs2sls 28 / 30

g2sls command II. estimates table gs2sls sarml, b se Variable gs2sls sarml crime hoval -.2561395 -.28069841.16213284.09724792 inc -1.1862206-1.2012051.52235246.33639724 _cons 52.28828 56.796767 9.4410739 6.1942805 lambda _cons.06515574.04272904.02736064.02866443 rho sigma _cons.0224828.0639603.08019667.07686377 _cons 9.7829296 1.0055006 legend: b/se 29 / 30

Summary and further research An increasing number of datasets contain spatial information Modeling the spatial processes in a dataset can improve efficiency, or be essential for consistency The Cliff-Ord type models provide a useful parametric approach to spatial data There is reasonably general statistical theory for the GS2SLS estimator for the parameters of cross-sectional Cliff-Ord type models We are now working on extending the GS2SLS to panel-data Cliff-Ord type models with large N and fixed T 30 / 30

Anselin, L. 1988. Spatial Econometrics: Methods and Models. Boston: Kluwer Academic Publishers. Arraiz, I., D. M. Drukker, H. H. Kelejian, and I. R. Prucha. 2008. A Spatial Cliff-Ord-type Model with Heteroskedastic Innovations: Small and Large Sample Results. Technical report, Department of Economics, University of Maryland. http://www.econ.umd.edu/ prucha/papers/wp Hetero GM IV MC.pdf. Cliff, A. D., and J. K. Ord. 1973. Spatial Autocorrelation. London: Pion.. 1981. Spatial Processes, Models and Applications. London: Pion. Kelejian, H. H., and I. R. Prucha. 1998. 30 / 30

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(1): 99 121.. 1999. A Generalized Moments Estimator for the Autoregressive Parameter in a Spatial Model. International Economic Review 40(2): 509 533.. 2004. Estimation of simultaneous systems of spatially interrelated cross sectional equations. Journal of Econometrics 118: 27 50. Lee, L. F. 2004. Asymptotic distributions of maximum likelihood estimators for spatial autoregressive models. Econometrica (72): 1899 1925. 30 / 30

Ord, J. K. 1975. Estimation Methods for Spatial Interaction. Journal of the American Statistical Association 70: 120 126. Tobler, W. R. 1970. A computer movie simulating urban growth in the Detroit region. Economic Geography 46: 234 40. 30 / 30