Spatial Analysis with R and Python

Material for Labs - Spatial Econometrics Advanced Institute 2022

Welcome to the Spatial Analysis with R and Python course! The material you will find on this site was created for the labs of the Spatial Econometrics Advanced Institute 2022 course organized by the Spatial Econometrics Association.

Before starting

I invite you to setup R and Python on your computer to be able to follow all the lessons without problems. In the pages R Setup and Python Setup you will find all the necessary information. If you are not an expert user of Python, I recommend you to use Colab. It is a totally cloud-based tool that avoids having to configure your computer (a google account is required).

In the section below you will find buttons for each lesson to automatically import all the material directly to Colab. Alternatively you can save all the material by downloading the ZIP file or cloning the Github repository.

Course schedule

Lab 1 - Intro to Python

Date: 03/06/2022

Open In Colab Open in web page

Topics:

  • Intro
  • 1 - Matrix computation with NumPy
  • 2 - Data manipulation and analysis with Pandas
  • 3 - Graphs with Matplotlib and Seaborn

Extras:

  • Extra topic: Git and Github (with Niccolò Salvini) Link slides
  • Extra material: Statistics with Python:
    • Open In Colab Extra: Linear regression
    • Open In Colab Extra: Logistic regression
    • Open In Colab Extra: SVM
    • Open In Colab Extra: k-means clustering
    • Open In Colab Extra: DBSCAN

Lab 2 - Intro to R

Date: 09/06/2022

Open in web page

Topics:

  • Intro
  • Matrix computation
  • Data manipulation with dplyr
  • Graphs with ggplot2

Lab 3 - Spatial W matrices with R

Date: 10/06/2022

Open in web page

Topics:

  • Intro
  • 1 - Loading and plotting Spatial Data
  • 2 - Computation of W matrix
  • Extra: rgeoda

Lab 4 - Spatial data and W matrices with Python

Date: 10/06/2022

Open In Colab Open in web page

Topics:

  • Intro
  • 1 - Loading and plotting Spatial Data
  • 2 - Computation of W matrix

Lab 5 - Spatial Autocorrelation with R

Date: 16/06/2022

Open in web page

Topics:

  • 1 - Spatial Lag
  • 2 - Moran’s I
  • 3 - Local Moran

Lab 6 - Spatial Econometrics Models with R

Date: 17/06/2022

Open in web page

Topics:

  • 1 - OLS
  • 2 - Tests on residuals
  • 3 - Spatial Lag Model
  • 4 - Spatial Error Model
  • 5 - SARAR

Lab 7 - ESDA and Spatial Econometrics Models with Python

Date: 17/06/2022

Open In Colab Open in web page

Topics:

  • Intro
  • 1 - Exploratory Spatial Data Analysis
  • 2 - Spatial Econometrics Models

Contributions

Author: Vincenzo Nardelli Github Linkedin Contributor: Niccolò Salvini Github

This course is released in open source. Feel free to reuse this material by citing the source! If you find an error or want to add any topics feel free to contribute to the project on the Github repository. The material in this website, including all code samples, is released under the Apache-2.0 License license.