library(terra)
# 1. Read the unthinned Bursera microphylla GBIF occurrence table
bursera_raw <- read.csv("data/bursera_observations_unthinned.csv", stringsAsFactors = FALSE)
# 2. Check dimensions, column names, and summary statistics
dim(bursera_raw)
names(bursera_raw)
summary(bursera_raw[, c("decimalLongitude", "decimalLatitude", "year")])
# 3. Inspect how observations were documented (Preserved Specimen vs. Human Observation)
basis_counts <- table(bursera_raw$basisOfRecord, useNA = "ifany")
print(basis_counts)
par(mar = c(4, 12, 3, 2))
barplot(sort(basis_counts), horiz = TRUE, las = 1, col = "steelblue",
main = "Bursera microphylla Records by Basis of Record", xlab = "Number of Records")
# 4. Compare median observation year by basisOfRecord and plot histogram
tapply(bursera_raw$year, bursera_raw$basisOfRecord, median, na.rm = TRUE)
hist(bursera_raw$year, breaks = 30, col = "forestgreen", border = "white",
main = "Temporal Distribution of Bursera microphylla Observations",
xlab = "Observation Year")
# 5. Locate the 1881 Parish Brothers specimen
oldest_idx <- which.min(bursera_raw$year)
bursera_raw[oldest_idx, c("year", "decimalLatitude", "decimalLongitude", "basisOfRecord")]
# 6. Convert valid coordinates into a SpatVector and map over WGS84 boundaries
valid_rows <- !is.na(bursera_raw$decimalLongitude) & !is.na(bursera_raw$decimalLatitude)
bursera_pts <- vect(bursera_raw[valid_rows, ],
geom = c("decimalLongitude", "decimalLatitude"),
crs = "EPSG:4326")
na_bound <- vect("data/na_boundaries_wgs84.gpkg")
plot(na_bound, ext = ext(-120, -105, 22.5, 36.0), col = "gray95", border = "gray60",
main = "GBIF Bursera microphylla Occurrences (WGS84)")
points(bursera_pts, pch = 19, col = adjustcolor("darkgreen", 0.5), cex = 0.6)Natural History Records and the Case of the Missing Absence
An Interactive Biogeography & Species Distribution Modeling Lab Featuring the Elephant Tree (Bursera microphylla)
This lab scales across introductory environmental/biological sciences and upper-division botany or spatial ecology courses:
- Biogeographic & Statistical Concepts frame every tab before you touch a slider, connecting ecological theory to quantitative mechanics.
- Core Inquiry prompts guide all students through foundational ecological reasoning, map interpretation, and controlled experiments inside the apps.
- Upper-Division Synthesis callouts challenge advanced students to test scale sensitivity, outgroup architecture, and primary literature.
- Appendix (Base R &
terra) provides three scaffolded coding exercises moving from reading raw GBIF tables to analyzing exported suitability rasters directly in R.
1 Part 0: Introduction to the Elephant Tree & The Case of the Missing Absence
1.1 A Biogeographic Mystery
Stand on a rocky granite bajada in the Gila Mountains just east of Yuma, Arizona, and you will meet the Elephant Tree (Bursera microphylla)—a gnarled, resinous, aromatic tree with peeling papery bark and swollen water-storing limbs. Across Baja California, coastal Sonora, Anza-Borrego, the Gila Mountains, and the central Arizona sky islands around Phoenix, B. microphylla flourishes on warm, rocky slopes.
Yet immediately north of the Gila Mountains lies a striking biogeographical riddle: across the thoroughly surveyed federal lands of the Lower Colorado River Valley (the hyper-arid Salton–Colorado Trough described by John Wesley Powell in 1875 and mapped as Shreve’s Microphyllous Desert subdivision in 1964), elephant trees are not to be found. To the west, they climb high into the rocky canyons of Anza-Borrego flanking the Laguna Mountains; to the east, they step northward along the sky islands past Phoenix. Why is the center empty?
Explore observations of the Elephant Tree on iNaturalist beginning with this one in the Gila Mountains. Then visit the species page and examine its geographic distribution. What gives the northern boundary of the Elephant Tree that distinctive two-pronged shape?
Now investigate its avian partner, the Gray Vireo (Vireo vicinior). Open this observation on iNaturalist and read the observer’s field notes carefully. Next, in the Explore tab of iNaturalist, search for all records of Vireo vicinior and use the date filter to compare where birds are observed in January versus June. What connections can you draw between the seasonal life cycles of the Gray Vireo and the Elephant Tree?
1.2 Biogeographic Principles: The BAM Framework
Why are organisms where they are? A foundational maxim of biogeography states that an organism must be able to both survive there and get there. Spatial ecologists formalize this principle through the BAM Framework (Soberón & Peterson, 2005):
- Abiotic conditions (\(\mathbf{A}\)): Physiological requirements and tolerances of temperature, moisture, and substrate—such as winter frost limits, rainfall seasonality, and rocky bajada microtopography.
- Biotic relationships (\(\mathbf{B}\)): Mutualisms, facilitation, and competition—most notably here the close partnership between B. microphylla and the Gray Vireo (Vireo vicinior), which winters in elephant tree groves feeding almost exclusively on their lipid-rich arillate fruits and regurgitating viable seeds across the landscape (Bates, 1992a, 1992b; Unitt, 2000).
- Movement & accessibility (\(\mathbf{M}\)): Whether a species—or its avian dispersal vector—can physically traverse basins, valleys, and mountain corridors to reach suitable habitat.
1.3 Solving the Case of the Missing Absence
Maps and Species Distribution Models (SDMs) allow us to project a species’ niche across space, into the Ice Age, and into the 21st century. Every statistical classification tool, however, requires observations of both where a species is (presences) and where it is not (absences).
The bedazzling archives compiled through iNaturalist and GBIF excel at documenting presences, yet they rarely record verified absences. Constructing biologically meaningful absences takes natural history sleuthing, ecological reasoning, and careful curation.
To solve the Case of the Missing Absence for Bursera microphylla without resorting to arbitrary random points, our data pipeline executes a two-step natural history cross-check:
- Constructing a Survey-Controlled Absence Pool (Target-Group Background + Outgroups): Following Phillips et al. (2009), we first read the
associatedTaxafield notes written on B. microphylla herbarium vouchers to identify the Top 10 plant genera most frequently recorded growing alongside elephant trees. Locations where botanists documented those same desert genera—yet never noted B. microphylla—serve as survey-controlled pseudo-absences.To anchor harder abiotic limits across the full perimeter of B. microphylla’s range, we weave in congeneric Bursera spp. (capturing the southern tropical deciduous forest transition in Sonora and Baja California Sur) and three biome outgroups: montane conifers (Pinaceae and Cupressaceae, anchoring cooler/wetter upland limits) and California chaparral (Adenostoma spp. — chamise and redshank, anchoring the western Mediterranean winter-rain ecotone along the Peninsular Ranges). - Double-Checking Associate Records for Hidden Presences: Before accepting any associate herbarium sheet as an absence, we ran a reciprocal search across every associate voucher’s
associatedTaxanotes for mentions of Bursera microphylla or its historical synonyms (Elaphrium microphyllum, Terebinthus microphylla). That cross-check uncovered 13 undocumented Bursera presences hiding inside other plants’ records—moving them out of the absence pool and into our verified presence map! Any grid cell occupied by B. microphylla is then strictly excluded from the absence pool at every spatial grain.
1.4 Pre-Lab Challenge: Formulate Your Competing Hypotheses
Before opening the Shiny modules, write two competing explanations for the absence of Bursera microphylla across the Lower Colorado River Valley north of the Gila Mountains:
- Hypothesis 1 (Abiotic Limitation): ________________________________________________
- Hypothesis 2 (Dispersal / Movement Limitation): ___________________________________
- Implications for Absences & Falsification: How would each hypothesis change whether you trust absence records inside the Lower Colorado River Valley? What independent evidence would falsify each hypothesis?
2 Module 1 (app1.R): Realized Niche, Herbarium Associates & CART
Launch Module 1 (app1.R) in RStudio. Use the Download (PNG) and Export Grid (GeoTIFF) buttons to save figures for your report.
2.1 Tab 1 (Overview & Bursera Presences): Natural History Archives & Observation Bias
- Biogeographic Concept — Co-Occurrence & Historical Range Records: Herbarium vouchers preserve not only where a species grew, but the living community surrounding it (
associatedTaxa) and the historical era of collection. Reading across collections reveals undocumented presences and guards against treating unsampled desert basins as true absences. - Statistical Concept — Spatial Thinning & Temporal Filtering: Raw community-science and museum records cluster tightly near roads and trailheads. Spatial thinning (collapsing occurrences to unique
1 km,5 km, or10 kmgrid cells) reduces spatial autocorrelation and sampling bias, trading raw sample size (\(n\)) for statistical independence.
2.1.1 Lab Exercise 1.1
- Core Inquiry: On Tab 1, notice the gold diamonds on the presence map—the 13 occurrences uncovered by reading
associatedTaxanotes on associate herbarium sheets (including synonyms Elaphrium microphyllum and Terebinthus microphylla). How does reading associate notes strengthen both our presence dataset and our confidence in inferred absences? - Core Inquiry: Use the search and sort controls in the Full Herbarium Associates Frequency Table to identify the top 5 plant genera most commonly recorded alongside B. microphylla. Why do these co-occurring plants give a more honest picture of collector survey effort than random background points (Phillips et al., 2009)?
Look toward the far northwestern edge of the Bursera occurrence map in Module 1, Tab 1. You will spot a striking outlier near 35°03'31.9"N, 119°24'03.4"W dating to 1881.
- Core Inquiry: Slide the Presence Observation Years filter forward past 1885 (e.g., to
1900–2026) and observe how the northern edge of the range—and the modeling domain on Tab 2—responds. Next, visit GBIF, locate this 1881 Bursera microphylla record, and inspect the digitized herbarium sheet. Who collected it? Where did they record collecting it? Which institution holds it now, and in what year was it accessioned? Why can a 19th-century label georeferenced a century later land far outside a species’ modern verified range, and what precautions should modelers take? - Historical Reflection: Research twin California botanists Samuel Bonsall Parish (1838–1928) and William Fletcher Parish (1840–1918) alongside the College of Pharmacy Herbarium (deposited at the New York Botanical Garden in 1970). Why were botanical herbaria and schools of pharmacy so closely linked in the late 1800s, and what aromatic, resinous properties of Burseraceae (the frankincense and myrrh family) drew medicinal interest?
2.2 Tab 2 (Domain & Single-Variable Explorer): Defining the Modeling Domain & Univariate Thresholds
- Biogeographic Concept — The Accessible Domain (\(\mathbf{M}\)): To have biological meaning, absences must come from places a species could plausibly reach. Buffering around known presences defines the modeling domain (\(\mathbf{M}\)): too narrow, and we truncate broader climatic contrasts; too wide, and we mistake distant dispersal barriers for climatic unsuitability.
- Statistical Concept — Sampling Without Replacement & 1D Recursive Splits: Drawing absences without replacement (via Balanced 1:1, Locally Paired Ring, or Capped Pool strategies) prevents duplicating pixels. The dashed reference line on the boxplot/density plot represents the single optimal threshold where a 1-split decision tree maximizes separation between presences and sampled absences.
2.2.1 Lab Exercise 1.2
- Core Inquiry: On Tab 2, note the ecologically intuitive palettes (warm ramps for temperature, blue ramps for moisture, greys for terrain/substrate). Select
BIO6: Min Temp Coldest Month (°C)and toggle between Boxplot by Taxon and Kernel Density Curves. Record the dashed 1-split CART threshold (___ °C). How does the winter frost tolerance of B. microphylla compare to Pinaceae (Outgroup), Cupressaceae (Outgroup),Adenostoma spp., and Bursera spp.? - Core Inquiry: Switch the Absence Sampling Strategy between Balanced 1:1, Locally Paired Ring, and Capped Pool. Observe how the red absence points shift geographically on the map and whether the single-variable CART split moves.
2.3 Tab 3 (CART Model & Suitability Map) & Tab 4 (Predictor Space & Splits): Interpretable Niche Rules
- Biogeographic Concept — Realized Niche & Extrapolation: Projecting a model trained inside the black domain ring across the entire Southwest reveals where climatically analogous habitat exists beyond the species’ current range—distinguishing local niche limits from broader geographic potential.
- Statistical Concept — CART, Gini Impurity & ROC/AUC: Classification and Regression Trees (CART) build transparent, “white-box” Yes/No rules by minimizing Gini Impurity (\(I_G(t) = 1 - \sum p(k\vert{}t)^2\)) at each split, regulated by the Complexity Parameter (
cp). The ROC Curve plots True Positive Rate (Sensitivity) against False Positive Rate (\(1 - \text{Specificity}\)) across all probability cutoffs; AUC (0.5= random chance,1.0= perfect separation) summarizes overall discrimination.
2.3.1 Lab Exercise 1.3
- Core Inquiry: Examine the pruned CART Tree (whose node colors match the map palette), Variable Importance, and ROC Curve (AUC). Click three contrasting sites on the map—(a) the Gila Mountains near Yuma, (b) the Lower Colorado River Valley north of Yuma, and (c) the Mogollon Rim / Sierra Madre uplands—and record their climate values and predicted probabilities.
- Core Inquiry (Geographic vs. Climatic Overfitting): Check
LONandLATin Model Predictors and inspect the resulting tree, AUC, and map extrapolation outside the black domain ring. Why is using raw coordinates misleading if our goal is to understand physiological limits or forecast future climate shifts? UncheckLONandLATbefore moving on.
Test your CART model across all three Spatial Thinning Grains (1 km, 5 km, 10 km). Then conduct a controlled outgroup ablation: first uncheck Adenostoma spp. (Outgroup) alone, and next uncheck Pinaceae (Outgroup), Cupressaceae (Outgroup), and Bursera spp. so only desert shrub associates remain.
- How does thinning grain change sample size (\(n\)), tree structure, and AUC?
- How does removing
Adenostoma spp. (Outgroup)change predicted suitability along the western Anza-Borrego / Peninsular Ranges ecotone (where Sonoran desert scrub meets winter-rain California chaparral)? - How does removing the conifer outgroups and congeneric Bursera alter predictions in Sonora and at high elevations? Connect your findings to Phillips et al. (2009).
2.4 Tab 5 (Hyperdimensional Niche Space: PCA & 3D): Ordination & Morphing Geographic into Climatic Space
- Biogeographic Concept — Hutchinsonian Hypervolume vs. Unoccupied Niche Space: Hutchinson envisioned the ecological niche as an \(n\)-dimensional environmental hypervolume. Comparing where pixels from the unoccupied Lower Colorado River Valley Trough (gold crosses) fall relative to B. microphylla presences (open black circles) tests whether the gap is climatically alien or an unoccupied slice of suitable niche space.
- Statistical Concept — Principal Component Analysis (PCA): Because bioclimatic and terrain predictors are collinear and measured in incompatible units (\(^\circ\text{C}\), \(\text{mm}\), indices), PCA standardizes every variable to a \(Z\)-score (\(\mu = 0, \sigma = 1\)) and rotates them into orthogonal Principal Components (
PC1,PC2) capturing maximum variance. Hover over vectors in the PCA Loadings plot to highlight individual drivers.
2.4.1 Lab Exercise 1.4: The 3D Geographic-to-Climatic Space Challenge
- Core Inquiry (Step 1 — Geographic Space): Uncheck all climate predictors and check only three variables:
LON,LAT, andELEV. Adjust the 3D Horizontal Angle and 3D Vertical Tilt sliders until the 3D scatter cloud aligns into a recognizable geographic map of Baja California, Sonora, and Arizona. Record your angles (Angle = ___°,Tilt = ___°). - Core Inquiry (Step 2 — Latitudinal Climate Swap): Keep
LONandELEV, uncheckLAT, and check a predictor with a strong latitudinal gradient (BIO6: Min Temp Coldest Month). Describe how the geometry of the “map” warps when latitude becomes thermal space. - Core Inquiry (Step 3 — Longitudinal Climate Swap): Uncheck
LONand check a predictor with a strong longitudinal gradient (BIO15: Precip Seasonality, capturing the west-to-east shift from winter-rain California/Baja to summer-monsoon Sonora/Arizona). Compare how cleanly Bursera (black circles), absences (red triangles), and the Lower Colorado Trough (gold crosses) separate in pure environmental space versus geographic space. - Core Inquiry: Restore the default climate/terrain predictors and inspect the 2D PCA plot. Do the gold crosses of the Lower Colorado Trough sit outside the Bursera presence cloud, or do they overlap?
3 Module 2 (app2.R): Random Forest, Avian Wings & The Trough Experiment
Launch Module 2 (app2.R) in RStudio.
3.1 Tab 1 (Random Forest Process, Map & PDPs): Ensembles & Non-Linear Responses
- Biogeographic Concept — Continuous Gradients vs. Abrupt Thresholds: Real plant physiology rarely flips like a light switch at a single temperature cutoff; survival and recruitment shift smoothly across interacting stress gradients of frost, drought, and rocky substrate.
- Statistical Concept — Random Forest, OOB ROC/AUC, PDPs & MaxSSS: A Random Forest (Breiman, 2001; Cutler et al., 2007) grows hundreds of bootstrap decision trees, randomly selecting \(m_{\text{try}} = \lfloor\sqrt{p}\rfloor\) predictors at each split to decorrelate trees and reduce variance. Each observation’s Out-Of-Bag (OOB) probability is predicted exclusively by trees that omitted that point during training, yielding an unbiased internal OOB ROC/AUC. Partial Dependence Plots (PDPs) trace the marginal log-odds of presence across each top driver, while MaxSSS (Maximum Sensitivity + Specificity; Liu et al., 2005, 2013) provides a literature-standard objective cutoff for binary habitat classification.
3.1.1 Lab Exercise 2.1
- Core Inquiry: Compare the Random Forest OOB ROC/AUC and smoothed suitability map against your single-tree CART outputs from Module 1. Why is an OOB ROC curve a more honest validation metric than evaluating a single CART tree on its own training data?
- Core Inquiry: Toggle RF Map Display between Continuous Suitability and Classified Presence/Absence (using MaxSSS). Read the three Partial Dependence Plots: identify the exact environmental ranges where B. microphylla suitability rises steeply or drops off.
3.2 Tab 2 (Gray Vireo Dispersal & USNVC Vegetation): Mutualism & Migratory Stepping Stones
- Biogeographic Concept — Directed Avian Dispersal & Structural Corridors: Because Vireo vicinior winters in Bursera stands feeding heavily on arillate seeds and migrates north to breed in mid-elevation Piñon-Juniper woodlands (Bates, 1992a; Unitt, 2000), its migratory routes act as the living movement vector (\(\mathbf{M}\)) for elephant tree seed dispersal. Structural vegetation classes (USNVC / WorldCover) reveal whether woodland stepping stones guide migrants along the Peninsular Ranges and Madrean Sky Islands while leaving the hyper-arid Lower Colorado Trough bypassed.
- Statistical Concept — Spatiotemporal Stratification & Cross-Layer Zonal Summaries: Partitioning avian observations by ecological season (
Winter,Spring,Summer,Fall), temporal era, and survey network (eBird,iNaturalist,Museum) prevents summer breeding records from masking winter frugivory or spring/fall transit routes. Zonal tables extract mean RF suitability and structural cover fractions across longitudinal test corridors and seasons.
3.2.1 Lab Exercise 2.2
- Core Inquiry: Set Map Backdrop to USNVC Structural Vegetation and inspect the seasonal Gray Vireo detections (Winter = purple, Spring = bright green, Summer/Breeding = gold, Fall = red). Toggle individual seasons on and off. Where do wintering birds overlap Bursera presences (black circles), and where do spring/fall migrants travel?
- Core Inquiry: Inspect both summary tables below the map: (a) the Longitudinal Corridor Comparison (
32.5°N–34.5°N) comparing the Peninsular Ranges (West), Lower Colorado River Valley (Center), and Madrean Sky Islands (East), and (b) RF Suitability & USNVC Vegetation by Gray Vireo Ecological Season. Do the data support the hypothesis that Gray Vireo migratory routes bypass the Lower Colorado Trough?
3.3 Tab 3 (Trough-Included vs. Trough-Masked RF): Separating Dispersal Limitation from Abiotic Filtering
- Biogeographic Concept — False Absences in Uncolonized Corridors: If B. microphylla is absent from the Lower Colorado River Valley north of the Gila Mountains because Gray Vireos do not disperse seeds through that corridor, then labeling surveyed desert shrubs inside the Trough as “climatically unsuitable absences” forces the SDM to confuse dispersal limitation (\(\mathbf{M}\)) with abiotic intolerance (\(\mathbf{A}\)).
- Statistical Concept — Counterfactual Sensitivity Analysis (Spatial Masking): Comparing Model A (Trough absences included) against Model B (Trough absences masked out via
terra::erase()) and their pixel-wise Difference Surface (Model B - Model A) quantifies exactly how sensitive both local and domain-wide suitability estimates are to our assumptions about absence validity.
3.3.1 Lab Exercise 2.3
- Core Inquiry: Toggle between Model A (Trough Included), Model B (Trough Masked), and Difference (
Model B - Model A). Inspect both Row 1 (Lower Colorado Valley Zoom) and Row 2 (Full Regional Modeling Domain) alongside their boxplots.- By how many percentage points does mean predicted suitability inside the Lower Colorado Trough change when Trough absences are masked?
- Does masking Trough absences alter predicted suitability only inside the Trough, or across the broader Sonoran modeling domain? Explain why.
Toggle Frac_Barren_Playa and TRI off and on in Module 2 Tab 3. Notice that even under Model B, flat hyper-arid alluvial plains remain less suitable than rugged pediments (like the Gila, Kofa, and Laguna flanks). Synthesizing evidence from PCA (Module 1 Tab 5), Gray Vireo corridors (Module 2 Tab 2), and Trough Masking (Module 2 Tab 3), argue whether the northern Bursera gap reflects pure abiotic filtering, pure dispersal limitation, or an interactive BAM bottleneck where isolated rocky microsites lie stranded across a corridor lacking avian woodland stepping stones.
4 Module 3 (app3.R): Deep Time Refugia, 21st-Century Forecasts & Climate Velocity
Launch Module 3 (app3.R) in RStudio.
4.1 Tab 1 (Paleoclimate Hindcast & Fossils): Quaternary Refugia & Independent Validation
- Biogeographic Concept — Pleistocene Refugia & Post-Glacial Recolonization: During the Last Glacial Maximum (~21,000 BP), cooler pluvial climates pushed frost-sensitive Sonoran subtropical trees southward into Baja California and coastal Sonora while piñon-juniper woodlands occupied modern desert lowlands (Van Devender, 1990; McAuliffe & Van Devender, 1998).
- Statistical Concept — Temporal Transferability & Epoch-Stratified Validation: Hindcasting a modern-trained Random Forest onto past climate grids (
Beyer2020) tests whether the model captures enduring physiological tolerances rather than local modern correlations. Evaluating predicted suitability across radiocarbon-dated Neotoma packrat midden macrofossils binned by Quaternary epoch provides an independent empirical test.
4.1.1 Lab Exercise 3.1
- Core Inquiry: Toggle between Last Glacial Maximum (21 ka) and Mid-Holocene (6 ka). Where did suitable habitat contract during the LGM, and when did it re-expand into southern Arizona? Inspect the Age-Stratified Neotoma Macrofossil Table: how well do fossil Bursera ages match the hindcast suitability percentages?
4.2 Tab 2 (21st-Century Forecast & Range Turnover): Climate Envelopes & Range Dynamics
- Biogeographic Concept — Leading-Edge Expansion vs. Trailing-Edge Contraction: Under 21st-century warming, thermally limited desert trees may experience newly suitable climate poleward and upslope (Expansion), persistent habitat (Stable Core), and aridification stress along warm southern margins (Contraction)—creating ecological tension zones (Gibson et al., 2013).
- Statistical Concept — Raster Algebra & Centroid Velocity: Applying a presence threshold to modern and CMIP6 future probability rasters classifies every 5 km pixel via raster algebra (
0 = Unsuitable,1 = Contraction,2 = Expansion,3 = Stable Core) and computes the mean latitudinal centroid shift (\(\text{km}\)).
4.2.1 Lab Exercise 3.2
- Core Inquiry: Compare mid-century moderate emissions (
ssp245_2041) against late-century high emissions (ssp585_2061). Record the percentage change in suitable cells and the Mean Northward Centroid Shift (km). - Core Inquiry: Toggle Mask Absences from Lower Colorado Trough in the sidebar on and off while inspecting the Range Turnover map. How does your assumption about the Lower Colorado Trough in Module 2 propagate into your 21st-century forecast?
4.3 Tab 3 (Climate Velocity Explorer): Topography as a Pace-Setter for Migration
- Biogeographic Concept — Topographic Buffering vs. Flat-Basin Exposure: On a steep mountain slope, moving a few hundred meters upslope rapidly lowers temperature; on a flat desert plain like the Lower Colorado Trough, an organism must migrate tens of kilometers to track the same isotherm.
- Statistical Concept — Spatial Climate Velocity (Loarie et al., 2009): Climate velocity (\(\text{km yr}^{-1}\)) divides the temporal rate of climate change by the magnitude of the local \(3 \times 3\) spatial gradient: \[\text{Velocity} = \frac{\Delta C / \Delta t}{\|\nabla C\|}\]
4.3.1 Lab Exercise 3.3
- Core Inquiry: Select
BIO1: Annual Mean Temp (°C)and compare Modern Baseline (CURR) to Late-Century High Emissions (ssp585_2061). Contrast the Regional Median |Velocity| against the Lower Colorado Trough Median |Velocity|. Why are velocities dramatically higher across the hatched Trough than along surrounding mountain ranges? - Core Inquiry: Now compare Last Glacial Maximum (
LGM) to Modern Baseline (CURR) forBIO1. How does the speed of post-glacial warming (\(\text{km yr}^{-1}\)) compare to projected 21st-century warming velocity?
Export your Current Baseline (Module 2 Tab 1) and Late-Century SSP5-8.5 (Module 3 Tab 2) GeoTIFFs. Combining your climate velocity metrics, Gray Vireo corridor analysis, and turnover maps, write a concise 1-page conservation memo evaluating whether B. microphylla can keep pace with 21st-century warming across the Lower Colorado corridor—and what landscape stewardship actions would best sustain this plant–bird mutualism.
5 Appendix: Hands-On Base R & terra Companion Exercises
These three scaffolded exercises introduce foundational Base R and terra spatial workflows alongside Modules 1–3. Run them in RStudio with your working directory set to the extracted Bursera_SDM_Suite/ folder.
5.1 Exercise A (Module 1 Companion): Tabular & Spatial Vector Basics
Learning Goals: Read CSV and vector files, inspect dimensions and metadata, compute summary statistics of basisOfRecord and year, and locate the 1881 Parish brothers specimen.
5.2 Exercise B (Module 2 Companion): Interactive Raster Operations with terra
Learning Goals: Load a multi-layer SpatRaster, inspect its spatial properties, and use interactive plot(), click(), zoom(), and crop() functions.
library(terra)
# 1. Load the 5 km WGS84 environmental stack and inspect properties
env_5km <- rast("data/env_5km_wgs84.tif")
nlyr(env_5km)
names(env_5km)
res(env_5km)
ext(env_5km)
crs(env_5km, describe = TRUE)
# 2. Subset and plot Minimum Temperature of the Coldest Month (BIO6)
bio6 <- env_5km[["BIO6"]]
na_bound <- vect("data/na_boundaries_wgs84.gpkg")
plot(bio6, col = hcl.colors(50, "YlOrRd", rev = TRUE),
main = "BIO6: Min Temp of Coldest Month (°C)")
plot(na_bound, add = TRUE, col = NA, border = "gray40")
# 3. Interactive click: inspect 3 locations (try Yuma, Anza-Borrego, and Flagstaff)
clicked_vals <- click(bio6, n = 3, xy = TRUE)
print(clicked_vals)
# 4. Interactive zoom: click two opposite corners around the Lower Colorado Valley
zoom(bio6, col = hcl.colors(50, "YlOrRd", rev = TRUE))
# 5. Programmatic crop and summary for the Lower Colorado River Valley
lcrv_box <- ext(-115.5, -113.3, 32.5, 34.5)
bio6_lcrv <- crop(bio6, lcrv_box)
summary(values(bio6_lcrv))5.3 Exercise C (Module 3 Companion): Suitability Surfaces vs. Observation Date
Learning Goals: Load your exported Current (Bursera_App2_RF_prob_WGS84.tif) and Future (Bursera_App3_ssp585_2061_WGS84.tif) probability GeoTIFFs, extract suitability values to every dated Bursera observation, and test whether historical records sit in areas predicted to gain or lose suitability.
library(terra)
# 1. Load exported Current and Future suitability GeoTIFFs & compute difference
r_curr <- rast("Bursera_App2_RF_prob_WGS84.tif")
r_fut <- rast("Bursera_App3_ssp585_2061_WGS84.tif")
r_delta <- r_fut - r_curr
# 2. Load Bursera observations with valid coordinates and observation years
bursera_raw <- read.csv("data/bursera_observations_unthinned.csv", stringsAsFactors = FALSE)
b_valid <- subset(bursera_raw,
!is.na(decimalLongitude) & !is.na(decimalLatitude) & !is.na(year))
xy <- cbind(b_valid$decimalLongitude, b_valid$decimalLatitude)
# 3. Extract Current, Future, and Change suitability to every observation
b_valid$suit_curr <- extract(r_curr, xy)[, 1]
b_valid$suit_fut <- extract(r_fut, xy)[, 1]
b_valid$suit_delta <- extract(r_delta, xy)[, 1]
b_valid <- subset(b_valid, !is.na(suit_curr) & !is.na(suit_fut))
# 4. Plot Suitability vs. Observation Year
par(mfrow = c(1, 2))
plot(b_valid$year, b_valid$suit_curr,
pch = 19, col = adjustcolor("forestgreen", 0.4), cex = 0.7,
xlab = "Observation Year", ylab = "Current Suitability Probability",
main = "Current Suitability vs. Observation Year")
fit_curr <- lm(suit_curr ~ year, data = b_valid)
abline(fit_curr, col = "navy", lwd = 2)
plot(b_valid$year, b_valid$suit_delta,
pch = 19, col = adjustcolor("darkorange", 0.4), cex = 0.7,
xlab = "Observation Year", ylab = "Projected Change (Future - Current)",
main = "21st-Century Shift vs. Observation Year")
abline(h = 0, lty = 2, col = "gray40")
fit_delta <- lm(suit_delta ~ year, data = b_valid)
abline(fit_delta, col = "firebrick", lwd = 2)
par(mfrow = c(1, 1))
# 5. Inspect linear regression summaries & era comparisons
summary(fit_curr)
summary(fit_delta)
cat("Mean Current Suitability (Pre-1950):",
round(mean(b_valid$suit_curr[b_valid$year < 1950]), 3), "\n")
cat("Mean Current Suitability (Post-2000):",
round(mean(b_valid$suit_curr[b_valid$year >= 2000]), 3), "\n")Data Sources, Curatorial Methods & Acknowledgments
5.4 Biodiversity & Environmental Data Archives
All spatial layers and occurrence records are standardized in native WGS84 (EPSG:4326) and drawn from open, community-curated public science repositories:
- Target Presences (Bursera microphylla): Gathered from the Global Biodiversity Information Facility (
DWCAarchive viargbif; GBIF.org, 18 November 2026, https://doi.org/10.15468/dl.ewkz66) and screened withCoordinateCleanerto exclude captive/living specimens, fossils, zero coordinates, country centroids, institution coordinates, and marine errors while preservingyear,basisOfRecord, andassociatedTaxa. Reciprocal reading of associate herbarium sheets (including historical synonyms Elaphrium microphyllum and Terebinthus microphylla) surfaced 13 previously uncataloged Bursera presences. Records were collapsed to a 1 km grid. - Curated Absence Pool (Target-Group Background & Outgroups): Gathered from GBIF via two uncapped downloads—montane conifer outgroups (Pinaceae & Cupressaceae; GBIF.org, 30 November 2026, https://doi.org/10.15468/dl.yuex6j) and Top-10 herbarium-associated genera + congeneric Bursera spp. (GBIF.org, 30 November 2026, https://doi.org/10.15468/dl.w872cx). Following Phillips et al. (2009), absences are sampled without replacement from surveyed locations after strictly excluding all cells occupied by B. microphylla.
- Predictor Variables (WorldClim 2.1 & ESA WorldCover): Late 20th-century climate (
BIO1–BIO19), elevation (ELEV), 1 km Terrain Ruggedness (TRI), Topographic Position (TPI), and barren substrate (Frac_Barren_Playa) were read at 1 km (30 arc-sec) resolution for every presence and absence and tagged with1 km,5 km, and10 kmthinning IDs. Regional projection rasters use the 5 km (2.5 arc-min) grid withTRIaggregated by pixel maximum (preserving mountain/bajada relief) andFrac_Barren_Playaaggregated by pixel minimum (preserving rocky desert micro-refugia). - Avian Dispersal Partner (Vireo vicinior) & Structural Vegetation (USNVC / ESA WorldCover): Gray Vireo observations spanning eBird, iNaturalist, and museum vouchers were gathered from GBIF (GBIF.org, 19 November 2026, https://doi.org/10.15468/dl.kp5uwe), stratified into four ecological seasons aligned with winter Bursera frugivory and spring/fall migration, and paired with USNVC-aligned physiognomic formations (
Woodland/Piñon-Juniper,Desert Bajada Scrub,Grassland,Hyper-Arid Barren). - Quaternary Paleoclimate (Beyer2020 via
pastclim) & Packrat Middens (Neotoma): Five-kilometer reconstructions for the Last Glacial Maximum (~21,000 BP) and Mid-Holocene (~6,000 BP) paired with radiocarbon-dated Bursera macrofossils from the Neotoma Paleoecology Database (neotoma2). - 21st-Century Climate Forecasts (CMIP6 ACCESS-CM2) & Climate Velocity: Five-kilometer projections for Mid-Century (
2041–2060) and Late-Century (2061–2080) under moderate (SSP2-4.5) and high-emissions (SSP5-8.5) pathways, supporting range-turnover modeling and spatial Climate Velocity analysis (Loarie et al., 2009).
5.5 Conceptual Design & Human–AI Collaboration Disclosure
The ecological framing, place-based Sonoran Desert pedagogy, reciprocal herbarium reading workflow, Lower Colorado River Valley dispersal-limitation inquiry, and deliberate shift toward non-extractive, relational scientific language were conceived and directed by Prof. Jacob Gibson (Arizona Western College / Northern Arizona University).
This three-module R Shiny application suite (R/helpers_wgs84.R, app1.R–app3.R), reproducible data curation pipeline, Quarto quickstart guide, and tiered CURE lab manual were co-developed through an iterative human–AI collaboration with Gemini (Google, Large Language Model, November–December 2026). Specifically, Gemini contributed to:
- Spatial & Curatorial Pipeline Engineering: Co-authoring the cache-first WGS84
terra,rgbif,CoordinateCleaner,pastclim, andneotoma2curation scripts, reciprocalassociatedTaxasynonym detection, multi-scale (1/5/10 km) thinning architecture, and bare-minimum distribution bundling. - Interactive Statistical & Visual Design: Implementing Base R and
terraspatial plotting, hover-emboldened PCA biplots, rotatable 3D niche projections, Out-of-Bag Random Forest ROC/AUC and Partial Dependence Plots, MaxSSS thresholding, counterfactual Trough masking, and Loarie et al. (2009) climate velocity mapping. - Curriculum Co-Authoring & Verification: Drafting tiered inquiry prompts, historical natural-history case studies, and Base R/
terracompanion exercises. All ecological interpretations, statistical algorithms, historical records, and spatial outputs were independently tested, verified, and curated by the human author.
- Suggested Software & Curriculum Citation: Gibson, J. (2026). Natural History Records and the Case of the Missing Absence: An Interactive R Shiny CURE Suite for Bursera microphylla & Vireo vicinior (Version 1.0, co-developed with Google Gemini) [Computer software and curriculum]. Arizona Western College / Northern Arizona University.
References
5.6 Natural History, Mutualisms & Sonoran Desert Biogeography
- Bates, J. M. (1992a). Frugivory on Bursera microphylla (Burseraceae) by wintering gray vireos (Vireo vicinior, Vireonidae) in the coastal deserts of Sonora, Mexico. The Southwestern Naturalist, 37(3), 252–258.
- Bates, J. M. (1992b). Winter territorial behavior of Gray Vireos. The Wilson Bulletin, 104(3), 425–433.
- McAuliffe, J. R., & Van Devender, T. R. (1998). A 22,000-year record of vegetation change in the north-central Sonoran Desert. Palaeogeography, Palaeoclimatology, Palaeoecology, 141(3–4), 253–275.
- Powell, J. W. (1875). Exploration of the Colorado River of the West and its Tributaries. Government Printing Office, Washington, D.C.
- Shreve, F., & Wiggins, I. L. (1964). Vegetation and Flora of the Sonoran Desert. Stanford University Press, Stanford, CA.
- Unitt, P. (2000). Gray Vireos wintering in California Elephant Trees. Western Birds, 31(4), 258–262.
- Van Devender, T. R. (1990). Late Quaternary vegetation and climate of the Sonoran Desert, United States and Mexico. In J. L. Betancourt, T. R. Van Devender, & P. S. Martin (Eds.), Packrat Middens: The Last 40,000 Years of Biotic Change (pp. 134–165). University of Arizona Press, Tucson, AZ.
5.7 Niche Theory, Species Distribution Modeling & Climate Velocity
- Breiman, L. (2001). Random forests. Machine Learning, 45(1), 5–32. https://doi.org/10.1023/A:1010933404324
- Cutler, D. R., Edwards, T. C., Jr., Beard, K. H., Cutler, A., Hess, K. T., Gibson, J., & Lawler, J. J. (2007). Random forests for classification in ecology. Ecology, 88(11), 2783–2792. https://doi.org/10.1890/07-0539.1
- Gibson, J., Moisen, G., Frescino, T., & Edwards, T. C. (2013). Using publicly available Forest Inventory data in climate-based models of tree species distribution: Examining effects of true versus altered location coordinates. Ecosystems, 17, 43–53. https://doi.org/10.1007/s10021-013-9703-y
- Liu, C., Berry, P. M., Dawson, T. P., & Pearson, R. G. (2005). Selecting thresholds of occurrence in the prediction of species distributions. Ecography, 28(3), 385–393.
- Liu, C., White, M., & Newell, G. (2013). Selecting thresholds for the prediction of species occurrence with presence-only data. Journal of Biogeography, 40(4), 778–789.
- Loarie, S. R., Duffy, P. B., Hamilton, H., Asner, G. P., Field, C. B., & Ackerly, D. D. (2009). The velocity of climate change. Nature, 462(7276), 1052–1055. https://doi.org/10.1038/nature08649
- Phillips, S. J., Dudík, M., Elith, J., Graham, C. H., Lehmann, A., Leathwick, J., & Ferrier, S. (2009). Sample selection bias and presence-only distribution models: Implications for background and pseudo-absence data. Ecological Applications, 19(1), 181–197.
- Soberón, J., & Peterson, A. T. (2005). Interpretation of models of fundamental ecological niches and species’ distributional areas. Biodiversity Informatics, 2, 1–10. https://doi.org/10.17161/bi.v2i0.4
5.8 Data Archives & Software
- Beyer, R. M., Krapp, M., & Manica, A. (2020). High-resolution terrestrial climate, bioclimate and vegetation for the last 120,000 years. Scientific Data, 7, 236. https://doi.org/10.1038/s41597-020-0552-1
- Fick, S. E., & Hijmans, R. J. (2017). WorldClim 2: New 1-km spatial resolution climate surfaces for global land areas. International Journal of Climatology, 37(12), 4302–4315. https://doi.org/10.1002/joc.5086
- GBIF.org. (18 November 2026). GBIF Occurrence Download (Bursera microphylla). https://doi.org/10.15468/dl.ewkz66
- GBIF.org. (19 November 2026). GBIF Occurrence Download (Vireo vicinior). https://doi.org/10.15468/dl.kp5uwe
- GBIF.org. (30 November 2026). GBIF Occurrence Download (Conifer Outgroups: Pinaceae & Cupressaceae). https://doi.org/10.15468/dl.yuex6j
- GBIF.org. (01 December 2026). GBIF Occurrence Download (Chaparral Outgroup: Adenostoma spp.). https://doi.org/10.15468/dl.e6aa84
- GBIF.org. (30 November 2026). GBIF Occurrence Download (Associated Desert Genera & Congeneric Bursera spp.). https://doi.org/10.15468/dl.w872cx
- Hijmans, R. J. (2024). terra: Spatial Data Analysis. R package. https://CRAN.R-project.org/package=terra
- Williams, J. W., et al. (2018). The Neotoma Paleoecology Database, a multiproxy, international, community-curated data resource. Quaternary Research, 89(1), 156–177. https://doi.org/10.1017/qua.2017.105