Spatial Econometrics
James P. LeSage
Department of Economics
University of Toledo
CIRCULATED FOR REVIEW
December, 1998
Preface
This text provides an introduction to spatial econometrics as well as a set of
MATLAB functions that implement a host of spatial econometric estimation
methods. The intended audience is faculty and students involved in mod-
eling spatial data sets using spatial econometric methods. The MATLAB
functions described in this book have been used in my own research as well
as teaching both undergraduate and graduate econometrics courses.
Toolboxes are the name given by the MathWorks to related sets of MAT-
LAB functions aimed at solving a particular class of problems. Toolboxes
of functions useful in signal processing, optimization, statistics, finance
and a host of other areas are available from the MathWorks as add-ons
to the standard MATLAB software distribution. I use the term Econo-
metrics Toolbox to refer to my collection of function libraries described
in a manual entitled Applied Econometrics using MATLAB available at
http://www.econ.utoledo.edu.
The MATLAB spatial econometrics functions used to apply the spatial
econometric models discussed in this text rely on many of the functions in
the Econometrics Toolbox. The spatial econometric functions constitute a
“library” within the broader set of econometric functions. To use the spatial
econometrics functions library you need to install the entire set of Econo-
metrics Toolbox functions in MATLAB. The spatial econometrics functions
library is part of the Econometrics Toolbox and will be installed and avail-
able for use as well as the econometrics functions.
Researchers currently using Gauss, RATS, TSP, or SAS for econometric
programming might find switching to MATLAB advantageous. MATLAB
software has always had excellent numerical algorithms, and has recently
been extended to include: sparse matrix algorithms and very good graphical
capabilities. MATLAB software is available on a wide variety of computing
platforms including mainframe, Intel, Apple, and Linux or Unix worksta-
tions. A Student Version of MATLAB is available for less than $100. This
version is limited in the size of problems it can solve, but many of the ex-
i
ii
amples in this text rely on a small data sample with 49 observations that
can be used with the Student Version of MATLAB.
The collection of around 450 functions and demonstration programs are
organized into libraries, with approximately 30 spatial econometrics library
functions described in this text. For those interested in other econometric
functions or in adding programs to the spatial econometrics library, see the
manual for the Econometrics Toolbox. The 350 page manual provides many
details regarding programming techniques used to construct the functions
and examples of adding new functions to the Econometrics Toolbox.This
text does not focus on programming methods. The emphasis here is on
applying the existing spatial econometric estimation functions to modeling
spatial data sets.
A consistent design was implemented that provides documentation, ex-
ample programs, and functions to produce printed as well as graphical pre-
sentation of estimation results for all of the econometric functions. This
was accomplished using the “structure variables” introduced in MATLAB
Version 5. Information from econometric estimation is encapsulated into a
single variable that contains “fields” for individual parameters and statistics
related to the econometric results. A thoughtful design by the MathWorks
allows these structure variables to contain scalar, vector, matrix, string,
and even multi-dimensional matrices as fields. This allows the econometric
functions to return a single structure that contains all estimation results.
These structures can be passed to other functions that can intelligently de-
cipher the information and provide a printed or graphical presentation of
the results.
The Econometrics Toolbox along with the spatial econometrics library
functions should allow faculty to use MATLAB in undergraduate and grad-
uate level courses with absolutely no programming on the part of students
or faculty.
In addition to providing a set of spatial econometric estimation routines
and documentation, the book has another goal, applied modeling strategies
and data analysis. Given the ability to easily implement a host of alternative
models and produce estimates rapidly, attention naturally turns to which
models and estimates work best to summary a spatial data sample. Much
of the discussion in this text is on these issues.
This text is provided in Adobe PDF format for online use. It attempts
to draw on the unique aspects of a computer presentation platform. The
ability to present program code, data sets and applied examples in an online
fashion is a relatively recent phenomena, so issues of how to best accomplish
a useful online presentation are numerous. For the online text the following
iii
features were included in the PDF document.
1. A detailed set of “bookmarks” that allow the reader to jump to any
section or subsection in the text.
2. A detailed set of “bookmarks” that allow the reader to jump to an
examples or figures in the text.
3. A set of “bookmarks” that allow the reader to view the spatial datasets
and documentation for the datasets using a Web browser.
4. A set of “bookmarks” that allow the reader to view all of the example
programs using a Web browser.
All of the examples in the text as well as the datasets are available offline
as well on my Web site: http://www.econ.utoledo.edu under the MATLAB
gallery icon.
Finally, there are obviously omissions, bugs and perhaps programming
errors in the Econometrics Toolbox and the spatial econometrics library
functions. This would likely be the case with any such endeavor. I would be
grateful if users would notify me when they encounter problems. It would
also be helpful if users who produce generally useful functions that extend
the toolbox would submit them for inclusion. Much of the econometric code
I encounter on the internet is simply too specific to a single research problem
to be generally useful in other applications. If econometric researchers are
serious about their newly proposed estimation methods, they should take
the time to craft a generally useful MATLAB function that others could use
in applied research. Inclusion in the spatial econometrics function library
would have the added benefit of introducing new research methods to faculty
and their students.
The latest version of the Econometrics Toolbox functions can be found on
the Internet at: http://www.econ.utoledo.edu under the MATLAB gallery
icon. Instructions for installing these functions are in an Appendix to this
text along with a listing of the functions in the library and a brief description
of each.
Contents
1 Introduction 1
1.1 Spatial econometrics ....................... 2
1.2 Spatial dependence ........................ 3
1.3 Spatial heterogeneity ....................... 6
1.4 Quantifying location in our models ............... 7
1.4.1 Quantifying spatial contiguity .............. 8
1.4.2 Quantifying spatial position ............... 13
1.5 The MATLAB spatial econometrics library .......... 18
1.5.1 Estimation functions ................... 21
1.5.2 Using the results structure ............... 23
1.6 Chapter Summary ........................ 27
1.7 References ............................. 28
2 Spatial autoregressive models 30
2.1 The first-order spatial AR model ................ 31
2.1.1 The far() function .................... 34
2.1.2 Applied examples ..................... 36
2.2 The mixed autoregressive-regressive model ........... 42
2.2.1 The sar() function .................... 43
2.2.2 Applied examples ..................... 44
2.3 The spatial errors model ..................... 50
2.3.1 The sem() function .................... 56
2.3.2 Applied examples ..................... 57
2.4 The general spatial model .................... 61
2.4.1 The sac() function .................... 62
2.4.2 Applied examples ..................... 64
2.5 An applied exercise ........................ 70
2.6 Chapter Summary ........................ 81
2.7 References ............................. 81
iv