BurkeyAcademy's GIS & Spatial Econometrics Project 2017-2018 REBOOT!

Using R, QGIS, and a little bit of GeoDa

Note: This site has been converted to a new website, and many links are broken. If you find something not working, please email mark at burkeyacademy . com. Thanks!

Course Video 1: Spatial Econometric Models:

For those that would like to cite this work, please use:

Burkey, Mark L. A Short Course on Spatial Econometrics and GIS. REGION, 5(3), 2018, R13-R18. https://doi.org/10.18335/region.v5i3.254

Link to Complete Playlist on YouTube

Introduction Video 0: About the Course: What we will be doing in this course (9 minutes)

Intro Video 1: Spatial Econometric Models: An overview of Spatial Econometrics and Spatial Econometric Models (A broad overview of the major spatial econometric models, Lag, Error, Kelejian-Prucha, Durbin, Manski, SLX) (Updated!) Handout from Video (35 minutes)

GIS Intro 1: Introduction to GIS with QGIS (Important basics for visualizing data, and creating spatial data sets for analysis) Download data used (24 minutes)

GIS Intro 2: Creating a custom spatial Data Set (i.e., Putting your regression data into a map for analysis.) Download Data Used (20 minutes)

Spatial Stats 2: ESDA with GEODA! Exploratory Spatial Data Analysis without spatial weights. (using the dataset we created in GIS Intro 2. above) Download the Spatial Dataset we Created (15 minutes)

Spatial Stats 3: Making Spatial Weights Part One: Spatial Weights Matrices: A primer on Spatial Weights Matrices, different options, ways to standardize them, and things you MUST understand before creating them. Link to the Handout (21 minutes)

Spatial Stats 3: Making Spatial Weights Part Two: Make and Test them in GeoDa! We create many weights matrices and use them to compute spatial correlations, and see if different ones matter. You can save these to use in R, MatLab, Stata, python, ... GeoDa has many tools to make, save, and visualize your weights matrices! Download the Spatial Dataset we Created Download GeoDa (Win, Mac, Linux) (30 minutes)

Spatial Regression 1: Let's Do a Spatial Regression in GeoDa! (and why should shouldn't!) A good Start- but Don't Stop Here!) We discuss how to do a spatial regression in GeoDa, and the limitations it has- especially the limited number of models, and lack of calculating marginal effects. (31 minutes)

Download the Handout Download the Dataset we used (same as previous)

Using R for Spatial Data Analysis

R Spatial Data 1: Read in SHP with R, RStudio, and spdep We read our spatial data set (SHP file) into R, read a contiguity GAL file from GeoDa into R, also recreate the contiguity file in R and check it matches what GeoDa did, and run a Moran's I. (21 minutes) Download R (free)

Download RStudio (free) Download New Version of SHP file we are using and R commands(ZIP file)

R Spatial Data 2: Make KNN from Lon/Lat text file, export as matrix We read in some lon/lats from a text file of population-weighted county centroids, make a k-nearest neighbor weights matrix, plot to view the neighbors, and export the weights matrix as a .csv file for use in Excel. Link to R Commands Link to Census Site

R Spatial Regression 1: The Four Simplest Models: We run OLS and tests for spatial dependence, then run the SLX (Spatially Lagged X), Lag Y (aka SAR), and Lag Error (Spatial Error) Models, and the Spatial Hausman test. Download data and commands here. Spatial Regression Cheat Sheet

R Spatial Regression 2: All of the models, Likelihood Ratio specification tests, and spatial Breusch-Pagan: We discuss the overall idea of choosing a spatial specification (local or global), then run through how to estimate all of the main flavors fo Spatial Econometric Models. Download the data, commands, handouts here

Download Links for Files, Programs, and Data

Note: I will be using MS Windows in the videos. If you want to run something else, that is up to you!

QGIS: Free GIS Software

R: The Free/Open Source Data Analysis Language

RStudio: Fancy Environment for R: Choose the Free Version

GeoDa (Win, Mac, Linux, free)

Link to Download LibreOffice Portable (Free Office Suite)

Link To Download 7Zip (Free compression program to open ZIP, 7z, and other compressed archives. The first .exe link should work for Windows Users)

The Mathematics of Great Circle Distance Formulas

Part 1: Great Circle Distances, Longitude and Latitude

I give some details and visualizations about longitude, latitude, and how "Great Circle Distance" formulas work. However, here I show you some EASY mathematics for understanding how to calculate a great circle distance WITHOUT actually covering any of the particular formulas people commonly use. Instead, I show you the intuition behind how they will work. In the next videos I cover several common formulas that are used in practice.

Part 2: Real Great Circle Distance Formulas (coming... sometime☺)

Old Material is Below here. Some good Stuff, but Mostly about MapWindow GIS.

Welcome! This is where I will index all of the files and videos for the Spatial Econometrics Course. FILES are linked to the left (<----See Files).

I do not charge for anything here. Also, where possible, all of the files and programs we use here will be free. If we will use a program or data that is not free, I will explicitly point this out. Otherwise, assume it is free! Click on the underlined link (like Intro Video 0:) to watch each video.

Old Download Links

Download the handout, US State/Territory Map and World Map from the Files Section on the left side (or click the links on the words)

Link to Download MapWindow (free GIS program)

Link to Download LibreOffice Portable (Free Office Suite)

Link To Download US Map Used (free SHP files of the US states)

Link to Download 2010 US County Map (free SHP of US 2010 Counties)

Link to Download World Map (free World SHP file)

Link To Download 7Zip (Free compression program to open ZIP, 7z, and other compressed archives. The first .exe link should work for Windows Users)

Introduction and Overview:

Intro Video 0: About the project (Beginning information about my plans for the course and what I hope to cover))

Intro Video 1: An overview of Spatial Econometrics and Spatial Econometric Models (A broad overview of the major spatial econometric models, Lag, Error, Kelejian-Prucha, Durbin, Manski, SLX)

Basic GIS Tools: with MapWindow (Open Source, very similar to ArcGIS):

Requirements: MapWindow, LibreOffice, US Map, World Map, Income Data (from Census Bureau)

GIS One: Basic GIS Tricks. (I called this "Video 2" in the video itself!) How to open maps (.SHP files) by adding and manipulating layers, edit them to remove unwanted areas, and save the new edited shapefile as a new file.

GIS Two: Data and Data Maps. Adding External Data to an existing SHP file and making Chloropleth Maps. This is very tedious, and there are easier ways... but I teach you a couple of slow and dirty ways to get it done.

Link to Income Data Excel File

GIS Two-B: Better Ways of Getting Data In. I told you that there were some better ways of getting data in, so here are two of them. Sorting, and using the "Swift-D" plugin.

GIS Three: Map Labels and Layouts. Here we label the states, and work with print layouts to make a pretty map with proper legends, titles, etc.

GIS Four: Census Geographies. Here we learn about census tracts, block groups, blocks, counties, MSAs, ZCTAs, congressional districts voting districts, school districts, lakes, metropolitan and micropolitan areas... Download link for free maps is below.

Census 2010 SHP Download Page

GIS Five: Importing and Mapping Points. Here we import a large number of points (population weighted block group centroids) from a CSV file, and add them to our map.

Link to download block group centroids

GIS Six: How to Determine and Export Longitude and Latitude of Centroids:

Here we take our shapefile of the world's countries and create center points, and export this data to a CSV file, and bring them into Excel.

GIS Seven: Matching Data and Mapping County Rural-Urban Continuum Codes. Here we map all US Counties with their 2013 Rural Urban Continuum Codes, creating a new variable in our map to match on.

Download Link for Original USDA-ERS Rural Urban Code Data

Download Link for my "Cleaned" USDA-ERS Rural Urban Code Data

Download Census SHP File of All US Counties

GIS Tricks 1: Making a Mapped Polygon, Finding Intersection and Difference

We create a mappable shape (e.g., hexagon, circle, ellipse), and then find the intersection of two shapefiles, first keeping the intersection, and then cut off the intersection. Lastly, we find the centroids.