Quickstart Guide: The Elephant Tree & Gray Vireo Interactive SDM Suite

Architecture, Curatorial Methods, and Deployment for Modules 1–3

Author

Jacob Gibson

1. Conceptual Architecture

This three-module R Shiny suite invites students and researchers into a structured conversation with a living, self-organizing desert ecosystem: the Elephant Tree (Bursera microphylla), its co-occurring Sonoran plant community, its primary winter avian dispersal partner the Gray Vireo (Vireo vicinior), and the shifting Quaternary and 21st-century climates of southwestern North America.

Rather than treating species distribution modeling (SDM) as a black-box extraction of points from pixels, the suite progresses across three connected ecological questions:

Module File Core Focus Primary Analytical Tools
Module 1 app1.R Realized Niche, Herbarium Associates & CART Multi-scale spatial thinning (1/5/10 km), observation-date filtering, searchable herbarium associate frequency table, single-variable boxplot/density explorer, Classification and Regression Trees (rpart), ROC/AUC, bivariate pairs() splits, interactive hover-highlighted PCA, and rotatable 3D niche space.
Module 2 app2.R Random Forest, Avian Dispersal & The Lower Colorado Trough Random Forest ensembles (randomForest), Out-Of-Bag (OOB) ROC/AUC, Top-6 Permutation Importance, Partial Dependence Plots (PDPs), MaxSSS thresholding, seasonal Vireo vicinior flyways over USNVC vegetation structure, and a controlled Trough-Included vs. Trough-Masked modeling experiment.
Module 3 app3.R Deep Time Refugia, 21st-Century Forecasts & Climate Velocity Paleoclimate hindcasts (Last Glacial Maximum 21 ka & Mid-Holocene 6 ka) evaluated against age-stratified Neotoma packrat midden macrofossils, CMIP6 21st-century forecasts & range turnover (SSP2-4.5 / SSP5-8.5), and a Climate Velocity Explorer (Loarie et al. 2009).

2. Repository Structure & Dependencies

All spatial layers and occurrence tables operate in native WGS84 (EPSG:4326) so coordinates align directly with GBIF, Neotoma, WorldClim, and standard GPS field logs.

InteractiveSDMs/
├── 01_data_prep_wgs84.R            # Cache-first WGS84 environmental & occurrence curation
├── 02_update_tgb_wgs84.R           # Uncapped GBIF download for Top-10 associates + Bursera spp.
├── R/
│   └── helpers_wgs84.R             # Shared palettes, thinning, ROC/AUC, MaxSSS, climate velocity
├── app1.R                          # Module 1: CART & Niche Foundations
├── app2.R                          # Module 2: Random Forest, Gray Vireo & Trough Masking
├── app3.R                          # Module 3: Deep Time, CMIP6 Forecasts & Climate Velocity
├── raw_data/                       # Local cache of raw GBIF downloads, 1 km env stack, & zips
├── shiny_data/                     # Herbarium frequency table, Neotoma fossils, Gray Vireo records
├── shiny_data_wgs84/               # Clean WGS84 5 km rasters & 1 km-extracted occurrence CSVs
├── quickstart.qmd                  # This guide
└── bursera_dispersal_lab.qmd       # Tiered undergraduate CURE lab + Base R/terra Appendix

Required R Packages

# Core Shiny & Modeling Runtime (required to run app1.R – app3.R)
install.packages(c("shiny", "terra", "rpart", "rpart.plot",
                   "randomForest", "dplyr", "tidyr", "DT"))

# Data Curation Pipeline Only (required only if rebuilding shiny_data_wgs84/)
install.packages(c("rgbif", "geodata", "stringr", "CoordinateCleaner",
                   "pastclim", "neotoma2"))

Launching Locally & Deploying

Run any module from your project root in RStudio:

setwd("path/to/InteractiveSDMs")
shiny::runApp("app1.R")
shiny::runApp("app2.R")
shiny::runApp("app3.R")

To publish each module independently to shinyapps.io via rsconnect, place each app script alongside R/helpers_wgs84.R and only the specific files from shiny_data_wgs84/ and shiny_data/ it reads, keeping each deployment bundle lightweight.


3. Data Sources & Curatorial Methods

Occurrence Curation & Target-Group Background (TGB)

  • Target Presences (Bursera microphylla): Gathered from the Global Biodiversity Information Facility (GBIF) as a full Darwin Core Archive (DWCA) within southwestern North America (-120° to -105°W, 22.5° to 36.0°N). Living/captive specimens, fossils, and flagged spatial anomalies (ocean points, zero coordinates, country centroids, biodiversity institutions) were screened with CoordinateCleaner, while retaining historical voucher metadata (year, basisOfRecord, associatedTaxa) so students can inspect edge cases such as the 1881 Parish brothers specimen.
  • Reciprocal Herbarium Reading: Every record in the co-occurring desert flora archive was read for mentions of Bursera microphylla or its historical synonyms (Elaphrium microphyllum, Terebinthus microphylla) in associatedTaxa. This surfaced 13 previously uncataloged Bursera presence records tucked inside associate herbarium notes, which are preserved and mapped distinctly in Module 1.
  • Curated 13-Group Absence Pool: Following Phillips et al. (2009), absences are drawn without replacement from cells where collectors surveyed sympatric flora without recording B. microphylla. The pool combines:
    1. Two Montane/Cool-Climate Outgroups: Pinaceae and Cupressaceae (anchoring colder/wetter abiotic limits across northern Mexico and southwestern uplands).
    2. Congeneric Context: Bursera spp. (sympatric congeners in Sonora and Baja California Sur where B. microphylla yields to tropical deciduous forest).
    3. Top 10 Herbarium Associates: The ten genera most frequently recorded alongside B. microphylla on voucher labels.
  • Multi-Scale Thinning: All presence and absence coordinates are paired with fine-scale 1 km (30 arc-sec) environmental values and tagged with cell_1km, cell_5km, and cell_10km grid identifiers. Any grid cell occupied by B. microphylla at the chosen thinning grain is strictly excluded from the absence pool.

Environmental, Paleoclimate, Future, Fossil & Avian Layers

  • Modern Climate & Terrain: WorldClim 2.1 (BIO1–BIO19) at 30 arc-second (extraction) and 2.5 arc-minute (~5 km projection/display) resolutions; elevation (ELEV), 1 km-derived maximum Terrain Ruggedness Index (TRI), mean Topographic Position Index (TPI), and ESA WorldCover Hyper-Arid Barren Substrate (Frac_Barren_Playa) aggregated to 5 km via pixel minimum to preserve rocky micro-refugia.
  • Paleoclimate & Future CMIP6: Last Glacial Maximum (21 ka) and Mid-Holocene (6 ka) climate slices (Beyer et al. 2020 via pastclim) paired with CMIP6 ACCESS-CM2 mid-century (2041–2060) and late-century (2061–2080) projections under moderate (SSP2-4.5) and high (SSP5-8.5) emissions pathways.
  • Quaternary Macrofossils: Radiocarbon-dated Bursera packrat (Neotoma) midden records gathered from the Neotoma Paleoecology Database and binned by epoch (Pleistocene/LGM, Early–Mid Holocene, Late Holocene).
  • Gray Vireo (Vireo vicinior) & USNVC Structure: GBIF Darwin Core observations spanning eBird, iNaturalist, and museum vouchers (-122° to -104°W, 22.5° to 41.5°N), organized into four ecological seasons aligned with Bursera fruiting and Vireo migration, overlaid onto USNVC-aligned structural vegetation formations derived from ESA WorldCover.