Unit 5: Statistics and Science
This unit turns data into evidence. It tests whether groups of places differ, models how one variable changes with others, and puts the pieces together into a reproducible spatial data science project, from the research question to the conclusion. It ends by testing Tobler’s first law of geography, that near things are more related than distant things: first deciding what “near” means, with distances and neighbors, and then measuring whether values on a map are clustered, random, or dispersed.
Chapter 18: Comparing Groups: p-values and ANOVA
This chapter places statistical tests in the cycle of data analysis. It explains what a p-value does and doesn’t tell you, and why the replication crisis changed how scientists report them. It then compares group means with analysis of variance, from a small worked example to median male age across North Carolina’s regions, with follow-up tests and alternatives for when ANOVA’s assumptions fail.
Chapter 19: Linear Regression
Regression asks how one variable changes as another changes. This chapter covers correlation, fitting a line with lm(), slopes, intercepts, residuals, and predictions, and how to read R’s model summary, including R² and adjusted R². It models median house value in North Carolina’s counties, then maps the residuals to see where the model fails.
Chapter 20: Writing a Spatial Data Science Project
This chapter steps back to ask how data become knowledge. It covers the data, information, knowledge, wisdom pyramid, big data, choosing sources, and why reproducibility and replicability matter. It then walks through the parts of a project, from the research question and background to methods, results, and conclusions, and ends with what makes a project spatial data science.
Chapter 21: Distance and Neighborhoods
This chapter covers what distance means and the main ways to measure it: Euclidean, great circle, Manhattan, and network distance. It then uses distance and shared borders to decide which features are neighbors, with distance bands, k nearest neighbors, and rook and queen contiguity, and stores those relationships in a neighborhood weight matrix, built in R with spdep.
Chapter 22: Spatial Clustering and Spatial Autocorrelation
This chapter tests objectively whether things on a map are clustered. It measures point patterns with the Average Nearest Neighbor ratio, global spatial autocorrelation with Moran’s I and a permutation test, and local hot spots and cold spots with Getis-Ord Gi*, using births in North Carolina’s counties.
months <- 12. In a dataset, a measured characteristic,
such as median income; each Census variable has a code.
The ability for anyone to rerun an analysis from its code and data and
get the same result.
The use of data that have a location attached to answer questions about
the world. It combines what we study (the spatial), how we
handle it (data skills), and how we ask and answer questions
(science).
The specific, answerable question a project sets out to answer, usually
with a place and a time.
Waldo Tobler’s statement that “everything is related to everything else,
but near things are more related than distant things.” It is the idea
behind spatial autocorrelation.
The probability of a result at least as extreme as yours if the null
hypothesis were true. It is not the chance the null hypothesis is true.
The discovery, in the 2010s, that many published findings fail to hold
up when other researchers repeat the studies.
A measure of spread: the standard deviation squared, so its units are
squared too. var() in R.
The middle value when values are sorted, so half are above and half
below. Unlike counts, medians can’t be added across areas.
Analysis of variance: a statistical test of whether the averages of
three or more groups differ, such as median age in three regions. It
compares variation between groups with variation within them.
A statistical model of how one variable (such as home price) changes
with one or more others (such as distance to downtown).
An observation’s actual value minus the value a model predicts for it.
Map them to see where a model fits poorly.
The share of the variation in y that a model explains, from 0
to 1.
R-squared lowered a little for each independent variable, so adding
useless variables can’t make a model look better. Use it to compare
models.
Data too large, fast, or varied for ordinary tools, often described by
three Vs: volume, velocity, and variety.
When a new study, with new data, answering the same question gets
consistent results.
Distance along the lines of a network, such as streets, adding up the
lengths of the segments on the route.
A neighbor definition: every feature within a set threshold distance is
a neighbor. dnearneigh() in spdep.
Polygons are neighbors if they share an edge or just a corner. On a
grid, each cell has eight. spdep’s default.
An n × n table, W, whose entry
wij records the neighbor relationship
between observations i and j.
The observed mean distance from each point to its nearest neighbor
divided by the mean expected at random. Below 1 is clustered.
The tendency for things that are close together to be more alike than
things that are far apart, such as neighboring counties having similar
incomes.
A global measure of spatial autocorrelation, from −1 (dispersed) through
0 (random) to +1 (clustered), with a p-value.
A test that shuffles values across locations many times and asks how
often the shuffles beat the observed statistic.
A cluster of places with unusually high values, such as a group of
neighborhoods with many burglaries. Finding hotspots is a common goal of
spatial analysis.
An area of low values surrounded by low values: a large negative Gi*
z-score.
A local statistic that gives each observation a z-score: large positive
for hot spots, large negative for cold spots.