Skip to content

parker-group/spatial_depend_2

Repository files navigation

Spatial Dependence — Part 2 (Correlograms & Semivariograms with CSV Data)

This tutorial builds on Correlogram Part 1 and Variogram Part 1.
It shows how to compute Moran’s I/Geary’s C correlograms and a semivariogram from simple CSV point data.

What you’ll learn

  • How to load your own CSV file of points
  • Project coordinates into meters for distance-based analysis
  • Define distance bins (rule of thumb: max lag = 1/3 of max pairwise distance)
  • Compute Moran’s I and Geary’s C correlograms
  • Compute a semivariogram (with gstat)
  • Compare correlogram vs. semivariogram

Example datasets

This repo includes two dummy CSVs so you can try the workflow immediately:

  • dummy_strong_spatial.csv — column COVIDincid (positive values, strong spatial trend)
  • dummy_no_spatial.csv — column KuruPrev (no meaningful spatial trend)

Quick start

A) View-only (already rendered)

Open the rendered HTML tutorial:

B) Hands-on (R installed on your computer)

In R:

install.packages(c("spdep", "sp", "sf", "ggplot2", "gstat", "rmarkdown"))  # first time
rmarkdown::render("CorrelVariogram_pt2.rmd", output_format = "html_document")

C) Hands-on in your browser (Binder)

Click to launch an interactive RStudio session in your browser:

Launch RStudio in Binder

When RStudio opens:

  1. In the Files pane, click CorrelVariogram_pt2.rmd
  2. Click Knit to render, or use Run ▶ to step through

Notes

  • The RMarkdown script auto-detects whether the dataset column is COVIDincid or KuruPrev.
  • If using your own CSV, ensure it has at least three columns: X, Y, and a numeric value column.
  • Always project to meters before running distance-based spatial analyses.

About

spatial dependence tutorial 2; load point data from CSVs, measure potential spatial dependence

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages