Natural History Records and the Case of the Missing Absence
An Interactive Biogeography & Species Distribution Modeling Lab
This lab is designed to scale across introductory environmental/biological sciences and upper-division botany or spatial ecology courses:
- Core Inquiry prompts guide all students through foundational ecological reasoning, map interpretation, and controlled experiments inside the interactive apps.
- Upper-Division Synthesis callouts challenge advanced students to evaluate statistical assumptions, scale dependence, and primary biogeographical literature.
- Appendix (Base R &
terra) provides three scaffolded coding exercises that move you from reading occurrence tables to analyzing exported suitability surfaces directly in R.
Part 0: Ecological Mystery & Historical Grounding
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 vanish. 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?
To investigate this question, we treat the desert not as a passive backdrop of inert variables, but as a living, self-organizing community of landforms, plants, migratory birds, and climate. Biogeographers organize the forces shaping a species’ range using the BAM Framework:
- Abiotic conditions (A): Temperature extremes (especially winter frost), rainfall seasonality, and rocky landform structure.
- Biotic relationships (B): Mutualisms, facilitation, and competition—most notably 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 (M): Whether a species—or its avian dispersal partner—can physically traverse valleys, basins, and mountain corridors to reach suitable habitat.
Formulate Your Competing Hypotheses
Before opening the apps, 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): ___________________________________
Part 1: Reading Natural History Collections & Niche Geometry (Module 1 — CART)
Launch Module 1 (app1.R).
1.1 Listening to Herbarium Vouchers (Tab 1)
On Tab 1 (Overview & Bursera Presences), inspect the map of B. microphylla records alongside the searchable Herbarium Associates Frequency Table.
- Core Inquiry: Notice the gold diamonds on the map. These represent 13 occurrences that were never cataloged as Bursera microphylla in GBIF’s primary species column—instead, they were discovered by reading the
associatedTaxafield notes written by botanists collecting other desert plants (searching for both Bursera microphylla and its historical synonyms Elaphrium microphyllum and Terebinthus microphylla). Why is reading collector field notes valuable when studying sparsely distributed desert trees? - Core Inquiry: Use the search bar in the Herbarium Associates Frequency Table to identify the top 5 plant genera most commonly recorded growing alongside B. microphylla. Why do these co-occurring plants give us a more honest estimate of where botanists have actually looked—and not found elephant trees—than scattering random points across the map (Phillips et al. 2009)?
Look toward the far northwestern corner of the Bursera occurrence map in Module 1, Tab 1. You will spot an intriguing northern outlier near 35°03'31.9"N, 119°24'03.4"W.
This record traces back to an 1881 collection made by twin pioneer California botanists Samuel Bonsall Parish (1838–1928) and William Fletcher Parish (1840–1918), which was later accessioned into the College of Pharmacy Herbarium and deposited at the New York Botanical Garden (NYBG) in 1970.
- Core Inquiry: Slide the Presence Observation Years filter forward past 1885 (e.g., to
1900–2026). Watch what happens to the northern edge of the occurrence map and the black modeling domain polygon on Tab 2. Why might a 19th-century specimen labeled broadly by region or county appear far outside the modern verified range when georeferenced a century later? - Historical Reflection: Look up the Parish brothers and the NYBG College of Pharmacy Herbarium. Why were botanical herbaria and schools of pharmacy so intimately intertwined in the late 19th century, and what aromatic/resinous qualities of Bursera (the frankincense and myrrh family, Burseraceae) attracted medicinal interest?
1.2 Spatial Grain & Single-Variable Thresholds (Tab 2)
Switch to Tab 2 (Domain & Single-Variable Explorer). Notice the cartographic palette: temperature variables appear in warm ramps, moisture variables in blue ramps, and terrain/substrate variables (TRI, TPI, Frac_Barren_Playa, ELEV) in neutral greys.
- Core Inquiry: Select
BIO6: Min Temp Coldest Month (°C)and toggle between Boxplot by Taxon and Kernel Density Curves. Record the dashed 1-split CART threshold value (___ °C). How does the winter temperature tolerance of B. microphylla compare to Pinaceae (Outgroup), Cupressaceae (Outgroup), and Bursera spp.? - Core Inquiry: Switch the Absence Sampling Strategy between Balanced 1:1, Locally Paired Ring, and Capped Pool. Describe how the geographic pattern of red absence points shifts on the map and whether the single-variable CART split moves.
1.3 Building & Testing a CART Niche Model (Tabs 3 & 4)
Switch to Tab 3 (CART Model & Suitability Map) and Tab 4 (Predictor Space & Splits).
- Core Inquiry: Examine the pruned CART Decision Tree, Variable Importance, and ROC Curve (AUC). Which two environmental variables sit at the top of the tree? Click on three contrasting locations on the suitability map—(a) the Gila Mountains near Yuma, (b) the Lower Colorado River Valley north of Yuma, and (c) the Sierra Madre / Rim uplands—and record the pixel climate values and predicted probabilities.
- Core Inquiry (Geographic vs. Climatic Space): Add
LON: LongitudeandLAT: Latitudeto your Model Predictors checkboxes. Observe what happens to the CART tree, AUC score, and map extrapolation outside the black domain ring. Why is including raw latitude and longitude dangerous if our goal is to understand physiological climate limits or project into future climates? RemoveLONandLATbefore continuing.
Test the model at all three Spatial Thinning Grains (1 km, 5 km, 10 km) while holding predictors constant. Then uncheck Pinaceae (Outgroup), Cupressaceae (Outgroup), and Bursera spp. so the model relies solely on desert shrub associates.
- How does thinning grain alter the sample size (\(n\)), tree depth, and AUC?
- How does removing the conifer outgroups and congeneric Bursera species change suitability predictions in northern Mexico and at high elevations? Connect your findings to Phillips et al. (2009) on target-group background bias.
1.4 Special Challenge: Morphing Geographic Space into Climatic Space (Tab 5)
Switch to Tab 5 (Hyperdimensional Niche Space: PCA & 3D).
In the 2D PCA plot, notice the symbology: open black circles (pch = 1) are Bursera presences, red inverted triangles (pch = 6) are sampled absences, and transparent gold crosses (pch = 3) are pixels inside the Lower Colorado River Valley Trough. Hover your cursor over the arrows in the PCA Loadings plot to highlight individual predictors.
- 3D Mapping Challenge (Step 1 — Geographic Space): In the sidebar under Model Predictors, uncheck all climate variables and check only three predictors:
LON,LAT, andELEV. Look at the 3D Environmental Space plot at the bottom of Tab 5. Adjust the 3D Horizontal Angle and 3D Vertical Tilt sliders until the 3D point cloud rotates into a recognizable top-down or oblique geographic map of Baja California, Sonora, and Arizona. Record the angle and tilt values you found (Angle = ___°,Tilt = ___°). - 3D Mapping Challenge (Step 2 — Latitudinal Climate Swap): Keep
LONandELEVchecked, uncheckLAT, and check a predictor with a strong latitudinal gradient—BIO6: Min Temp Coldest Month (°C)(orBIO1). Describe how the “map” warps as latitude becomes thermal space. - 3D Mapping Challenge (Step 3 — Longitudinal Climate Swap): Now uncheck
LONand check a predictor with a strong longitudinal gradient across the Southwest—BIO15: Precip Seasonality (CV)(capturing the west-to-east shift from winter-rain California/Baja to summer-monsoon Sonora/Arizona). Compare the separation of Bursera (black circles), absences (red triangles), and the Lower Colorado Trough (gold crosses) in this 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 completely outside the black circle cloud of Bursera microphylla, or do they overlap? What does this suggest about your two hypotheses from Part 0?
Part 2: Ensembles, Avian Wings, and the Trough Experiment (Module 2 — Random Forest)
Launch Module 2 (app2.R).
2.1 From a Single Tree to a Forest (Tab 1)
Single CART trees carve abrupt rectangular splits that can shift dramatically if a few records change. Random Forest (Breiman 2001; Cutler et al. 2007) grows hundreds of bootstrap decision trees—selecting a random subset of predictors (mtry, defaulting to \(\lfloor \sqrt{p} \rfloor\)) at every split—and averages their votes into a smooth suitability surface.
- Core Inquiry: Inspect the Random Forest OOB ROC Curve (AUC), Top 6 Predictors, and Partial Dependence Plots (PDPs). Why does using Out-Of-Bag (OOB) predictions give a more trustworthy accuracy estimate than testing a single CART tree on its own training data?
- Core Inquiry: Toggle the RF Map Display between Continuous Suitability and Classified Presence/Absence. Notice the MaxSSS (Maximum Sensitivity + Specificity) threshold rule (Liu et al. 2005, 2013). Read the three Partial Dependence Plots: for your top temperature or terrain driver, over what range of values does Bursera suitability climb steeply or drop off?
2.2 Reading the Dispersal Partner: Gray Vireos & USNVC Vegetation (Tab 2)
Switch to Tab 2 (Gray Vireo Dispersal & USNVC Vegetation).
- Core Inquiry: Set the 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 (purple) concentrate relative to Bursera microphylla presences (black circles)? Where do breeding birds (gold) concentrate relative to Piñon-Juniper woodlands?
- Core Inquiry: Examine the Longitudinal Corridor Comparison Table (
32.5°N–34.5°N) comparing:- 1. West: Peninsular Ranges (Anza-Borrego / Lagunas)
- 2. Center: Lower Colorado River Valley (Lowland Gap)
- 3. East: Madrean Sky Islands (Phoenix / Mogollon)
Vireo_Records,Woodland_PJ_Pct, andBursera_Cellsacross all three corridors. Then inspect the RF Suitability & USNVC Vegetation by Gray Vireo Ecological Season table. Do the seasonal migratory pathways and woodland stepping stones support Bates’ (1992a) and Unitt’s (2000) mutualism hypothesis?
2.3 The Lower Colorado Trough-Masking Experiment (Tab 3)
Switch to Tab 3 (Trough-Included vs. Trough-Masked RF).
If Bursera microphylla is absent from the Lower Colorado River Valley north of the Gila Mountains because Gray Vireos bypass that hyper-arid lowland during migration, then treating TGB points inside the Trough as “climatically unsuitable absences” introduces a dispersal-limitation bias into our niche model.
- Core Inquiry: Toggle the radio button between Model A (Trough Included), Model B (Trough Masked), and Difference (Model B minus Model A). Compare Row 1 (Lower Colorado Valley Zoom) and Row 2 (Full Regional Domain) along with their boxplots.
- By how many percentage points does mean suitability inside the Trough shift when Trough absences are masked?
- Does masking the Trough change suitability predictions only inside the Trough, or across the whole Sonoran modeling domain? Explain why.
Toggle Frac_Barren_Playa and TRI off and on in Module 2 Tab 3. Even when Trough absences are masked (Model B), parts of the Lower Colorado basin remain less suitable than surrounding rocky mountain flanks (like the Gila, Kofa, and Laguna pediments). Synthesize your evidence from PCA (Module 1 Tab 5), Gray Vireo corridors (Module 2 Tab 2), and Model B (Module 2 Tab 3): is the northern Bursera gap purely an abiotic filter, purely dispersal limitation, or an interactive BAM bottleneck where sparse rocky microsites are isolated by a corridor lacking woodland stepping stones for avian vectors?
Part 3: Deep Time Refugia, 21st-Century Shifts & Climate Velocity (Module 3)
Launch Module 3 (app3.R).
3.1 Quaternary Refugia & Packrat Midden Validation (Tab 1)
During the Last Glacial Maximum (~21,000 years BP), cooler and wetter pluvial climates supported piñon-juniper woodlands across much of the modern Sonoran lowlands (Van Devender 1990; McAuliffe & Van Devender 1998).
- Core Inquiry: Switch between Last Glacial Maximum (21 ka) and Mid-Holocene (6 ka) on Tab 1. Where did suitable climate for Bursera microphylla contract during the Ice Age? How closely do the radiocarbon-dated Neotoma / Packrat Midden Macrofossils align with the hindcast suitability summarized in the Age-Stratified Fossil Table?
3.2 21st-Century CMIP6 Forecasts & Range Turnover (Tab 2)
Switch to Tab 2 (21st-Century Forecast & Range Turnover).
- 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 viewing the 21st-Century Range Turnover map. How does your assumption about whether the Trough is climatically unsuitable versus dispersal-limited alter your conservation forecast for B. microphylla in southwestern Arizona and southeastern California?
3.3 Climate Velocity Explorer (Tab 3 — Loarie et al. 2009)
Switch to Tab 3 (Climate Velocity Explorer). Loarie et al. (2009) defined climate velocity (\(\text{km yr}^{-1}\)) as the ratio of temporal climate change (\(\Delta C / \Delta t\)) to the local spatial climate gradient (\(\nabla C\)):
\[\text{Velocity} = \frac{\Delta C / \Delta t}{\|\nabla C\|}\]
- Core Inquiry: Select
BIO1: Annual Mean Temp (°C)and compare Modern Baseline (CURR) to Late-Century High Emissions (ssp585_2061). Compare the Regional Median |Velocity| against the Lower Colorado Trough Median |Velocity|. Why must a plant or bird living on a flat desert basin migrate many times faster to track a constant temperature than an organism living on a steep mountain bajada? - Core Inquiry: Now compare Last Glacial Maximum (
LGM) to Modern Baseline (CURR) forBIO1. Contrast the speed of natural post-glacial warming (\(\text{km yr}^{-1}\)) with projected 21st-century warming velocity.
Export your Modern Baseline and 2080 SSP5-8.5 prediction GeoTIFFs from Modules 2 and 3. Combining your climate velocity estimates, Gray Vireo flyway data, and 21st-century turnover maps, write a concise 1-page management memo evaluating whether Bursera microphylla can naturally colonize newly suitable northern habitat across the Lower Colorado corridor—and what landscape-scale stewardship actions (e.g., protecting riparian/woodland stepping stones or rocky desert bajadas) would best support this mutualistic community.
Part 4: Data Sources, Curatorial Methods & Works Cited
Summary of Open Data Repositories Used in This Lab
- GBIF (Global Biodiversity Information Facility): Occurrence records for Bursera microphylla, Top-10 associated desert genera, Bursera congenerics, Pinaceae/Cupressaceae outgroups, and Vireo vicinior (eBird, iNaturalist, museum vouchers).
- WorldClim 2.1 & CMIP6 (
ACCESS-CM2): Modern (1970–2000) 30 arc-sec & 2.5 arc-min bioclimatic variables and future (2041–2060,2061–2080) SSP2-4.5 / SSP5-8.5 projections. - Paleoclimate (
pastclim/ Beyer et al. 2020): Last Glacial Maximum (21 ka) and Mid-Holocene (6 ka) reconstructions. - Neotoma Paleoecology Database: Radiocarbon-dated packrat (Neotoma) midden plant macrofossils.
- ESA WorldCover / USNVC Framework: 1 km structural landcover aggregated to USNVC-aligned physiognomic formations (
Woodland/PJ,Desert Scrub,Grassland,Barren/Playa).
Works Cited
- 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.
- Breiman, L. (2001). Random forests. Machine Learning, 45(1), 5–32.
- 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.
- 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.
- 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.
- 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.
- 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.
Appendix: Hands-On Base R & terra Companion Exercises
These three scaffolded exercises introduce foundational R skills alongside each Shiny module using clean Base R functions and the terra spatial package. Run them directly in RStudio with your working directory set to the project folder.
Exercise A (Module 1 Companion): Tabular & Spatial Vector Basics
Learning Goals: Read CSV and vector files, inspect data dimensions and properties, and compute simple summary statistics of basisOfRecord and collection year.
library(terra)
# 1. Read the raw Bursera microphylla GBIF occurrence table
bursera_raw <- read.csv("raw_data/gbif_bursera_raw.csv", stringsAsFactors = FALSE)
# 2. Check dimensions, column names, and structure
dim(bursera_raw)
head(names(bursera_raw), 25)
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)
# Visualize counts with a horizontal barplot
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. Explore observation years: compare median year by basisOfRecord
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 spatial vector (SpatVector) and plot with 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("shiny_data_wgs84/na_boundaries_wgs84.gpkg")
plot(na_bound, ext = ext(-120, -105, 22.5, 36.0), col = "gray95", border = "gray60",
main = "Raw GBIF Bursera microphylla Occurrences (WGS84)")
points(bursera_pts, pch = 19, col = adjustcolor("darkgreen", 0.5), cex = 0.6)Check-In Questions (Exercise A): 1. How many rows and columns are in bursera_raw? 2. Which basisOfRecord category has the oldest median collection year, and which has the most recent? What does this tell you about the shift from museum herbaria to community science (e.g., iNaturalist)?
Exercise B (Module 2 Companion): Interactive Raster Exploration with terra
Learning Goals: Load a multi-band SpatRaster, inspect spatial properties, and use interactive plot(), click(), zoom(), and crop() operations.
library(terra)
# 1. Load the 5 km WGS84 environmental stack
env_5km <- rast("shiny_data_wgs84/env_5km_wgs84.tif")
# 2. Check raster properties: layers, resolution, extent, and CRS
nlyr(env_5km)
names(env_5km)
res(env_5km)
ext(env_5km)
crs(env_5km, describe = TRUE)
# 3. Subset and plot Minimum Temperature of the Coldest Month (BIO6)
bio6 <- env_5km[["BIO6"]]
na_bound <- vect("shiny_data_wgs84/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")
# 4. Interactive Inspection: click 3 locations on the map (press ESC when done)
# Try clicking Yuma, Anza-Borrego, and Flagstaff!
clicked_vals <- click(bio6, n = 3, xy = TRUE)
print(clicked_vals)
# 5. Interactive Zoom: draw a bounding box around the Yuma / Lower Colorado Valley
# (Click two opposite corners on the plot window)
zoom(bio6, col = hcl.colors(50, "YlOrRd", rev = TRUE))
# 6. Programmatic Crop & Summary for the Lower Colorado River Valley box
lcrv_box <- ext(-115.5, -113.3, 32.5, 34.5)
bio6_lcrv <- crop(bio6, lcrv_box)
summary(values(bio6_lcrv))Check-In Questions (Exercise B): 1. What are the units of res(env_5km) in WGS84? 2. Compare the minimum and maximum BIO6 values inside bio6_lcrv to the values you clicked in upland Arizona.
Exercise C (Module 3 Companion): Suitability Over Time vs. Observation Date
Learning Goals: Load two probability surfaces exported from the Shiny apps (Current Baseline from Module 2 Tab 1 and 2080 Forecast from Module 3 Tab 2), extract suitability values to the raw Bursera observations, and evaluate whether older historical records sit in areas predicted to lose or gain suitability.
(Prerequisite: Download Bursera_App2_RF_prob_WGS84.tif from Module 2 Tab 1 and Bursera_App3_ssp585_2061_WGS84.tif from Module 3 Tab 2, and save both into your project folder.)
library(terra)
# 1. Load your exported Current and Future suitability GeoTIFFs
r_curr <- rast("Bursera_App2_RF_prob_WGS84.tif")
r_fut <- rast("Bursera_App3_ssp585_2061_WGS84.tif")
# Compute the pixel-by-pixel suitability change (Future minus Current)
r_delta <- r_fut - r_curr
# 2. Load raw Bursera observations and filter to records with coordinates & year
bursera_raw <- read.csv("raw_data/gbif_bursera_raw.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 values 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]
# Drop observations falling outside the terrestrial raster extent
b_valid <- subset(b_valid, !is.na(suit_curr) & !is.na(suit_fut))
# 4. Plot Predicted Suitability vs. Observation Year
par(mfrow = c(1, 2))
# Panel 1: Current Suitability vs. Year
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. Collection Year")
fit_curr <- lm(suit_curr ~ year, data = b_valid)
abline(fit_curr, col = "navy", lwd = 2)
# Panel 2: Projected 21st-Century Change (Future - Current) vs. Year
plot(b_valid$year, b_valid$suit_delta,
pch = 19, col = adjustcolor("darkorange", 0.4), cex = 0.7,
xlab = "Observation Year", ylab = "Suitability Change (Future - Current)",
main = "Projected Suitability Shift vs. 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 & check pre-1950 vs. post-2000 means
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")Check-In Questions (Exercise C): 1. Do historical observations (e.g., pre-1950) show lower or higher predicted modern suitability than post-2000 observations? Could georeferencing uncertainty (like the 1881 Parish specimen) or recent 20th-century warming explain any trend you see? 2. Looking at suit_delta, are most known Bursera microphylla collection sites predicted to gain suitability (> 0), hold steady (≈ 0), or experience trailing-edge stress (< 0) by late century?