Yuchun Chen · Fragoso Lab, 2025 Results presented to Unini River communities, San Cristóbal de las Casas, Mexico, November 2025
This project investigates how Brazil nut (Bertholletia excelsa, locally known as Castanheira) harvesting activity affects wildlife biodiversity in the Unini Extractive Reserve, Brazilian Amazon. Working with 12 transects across a landscape with varying harvest intensity, we ask: does human trail use and castanheira tree density predict species occupancy and richness?
The pipeline integrates four independent biodiversity monitoring methods into a unified Bayesian modeling framework, enabling cross-method comparison of detection performance and ecological inference.
This project involved substantial data engineering and statistical modeling challenges across a complex, real-world field dataset:
Multi-source data integration. Harmonizing four detection methods — camera traps, eDNA from water, eDNA from soil, and invertebrate-derived DNA (iDNA) from flies — recorded at different spatial and temporal resolutions into a common site × occasion × species detection array.
Imperfect and heterogeneous detection. Each method has a distinct detectability profile. The Bayesian occupancy framework explicitly separates detection probability from true occupancy, accounting for the fact that absence of a detection does not equal absence of a species.
Unidentified records handling. Camera trap data contained "NI" (Not Identified) entries for animals that could not be identified to species level. These were resolved to taxonomic class (Aves, Mammalia, Reptilia) where possible rather than discarded, preserving detection information without overstating taxonomic certainty.
Temporal aggregation strategy. Raw daily records were aggregated into 2-week occasions for camera traps and encounters, and 10-day occasions for acoustic signals, to reduce temporal autocorrelation while preserving statistical power for the occupancy model.
Variable effort modeling. Sampling effort varied across sites and occasions due to camera malfunctions, weather events, and field logistics. Camera trap and transect models incorporate effort covariates directly in the detection submodel to prevent confounding true occupancy with sampling intensity.
MCMC convergence at scale. Models were fit to 50 species simultaneously across 12 sites and up to 30 sampling occasions. This required careful prior specification, tailored MCMC settings per method, and systematic convergence assessment using Gelman-Rubin diagnostics (R̂ < 1.1 for all monitored parameters).
- 12 transects (T1–T12) in the Unini Extractive Reserve, each characterized by trail use intensity (Low/Unused vs. Frequent/Intense) and castanheira tree count
- Four detection methods deployed simultaneously across all transects
- Sampling period: May 2023 – October 2023
A multi-species hierarchical Bayesian occupancy model was implemented in JAGS via rjags. The same model structure was applied consistently across all four methods, enabling direct comparison of occupancy and detection parameter estimates.
Occupancy submodel (shared across all methods):
logit(ψ[i,j]) = α₀[i] + α₁[i] × TrailUse[j] + α₂[i] × Castanheira_std[j]
Detection submodel (method-specific covariates):
# Camera traps & eDNA:
logit(p[i,j,k]) = β₀[i] + β₂ × Effort[j,k]
# Encounter & signal transects (adds weather):
logit(p[i,j,k]) = β₀[i] + β₁[Weather[j,k]] + β₂ × Effort[j,k]
| Parameter | Description |
|---|---|
ψ[i,j] |
Occupancy probability for species i at transect j |
α₀[i] |
Species-specific baseline occupancy (logit scale) |
α₁[i] |
Effect of trail use intensity on occupancy |
α₂[i] |
Effect of castanheira density (standardized) on occupancy |
p[i,j,k] |
Detection probability for species i at site j on occasion k |
β₀[i] |
Species-specific baseline detectability |
β₁[w] |
Weather effect on detection (encounter/signal methods only) |
β₂ |
Sampling effort effect on detection (shared across species) |
All priors are weakly informative: Normal(0, σ = 10) on the logit scale.
| Covariate | Type | Description |
|---|---|---|
| Trail Use | Binary | 0 = Low/Unused, 1 = Frequent/Intense |
| Castanheira Density | Continuous (standardized) | Count of castanheira trees per transect, mean-centered and scaled |
| Sampling Effort | Binary or Continuous | Whether/how much sampling occurred per occasion |
| Weather | Categorical | Sunny / Cloudy / Rainy / Partly Cloudy (encounter & signal only) |
.
├── analysis/
│ ├── camera_traps/ # Data prep + occupancy model + plotting (R)
│ ├── edna/ # eDNA (flies/soil/water) occupancy pipeline (R)
│ ├── encounter/ # Line transect encounter detection pipeline (R)
│ └── signals/ # Acoustic signal detection pipeline (R)
├── models/ # JAGS model specification files (.jags)
│ ├── cam_multi_species_occupancy_twoweek.jags
│ ├── dna.multi_species_occupancy.jags
│ ├── enc.multi.species.occupancy.day.jags
│ └── sig.multi_species_occupancy_10day_binary.jags
├── figures/ # Example output plots (see note below)
│ └── example/ # Representative sample figures from camera trap analysis
├── notebooks/
│ ├── Cameratrap.visual.ipynb # Camera trap location & activity visualization
│ └── heatmap.ipynb # Species abundance heatmap animation
├── Cam.Tree.loc.html # Interactive map of camera trap and tree locations
└── presentation/
└── unini_conference_presentation.pdf
Note on figures: Full result figures are not included in this repository out of respect for the research team's publication process. A small set of representative example outputs is provided in
figures/example/to illustrate the type of visualizations the pipeline produces. All figures can be reproduced by running the analysis scripts on the original data.
Each analysis subfolder follows the same four-step pipeline:
| Script | Purpose |
|---|---|
*model*.R |
Load raw data, handle NI/Empty records, build detection array, fit JAGS model |
*plot*.R |
Read posterior summaries, generate all output figures |
install.packages(c("tidyverse", "rjags", "coda", "lubridate",
"viridis", "purrr", "stringr", "tidyr"))JAGS must be installed separately before using rjags.
pip install jupyter pandas matplotlib seaborn foliumEach method is self-contained and can be run independently. From within an analysis subdirectory (e.g., analysis/camera_traps/):
# Fit the model (requires raw data — see note below)
source("cam.model.14.R")
# Generate output figures from saved model results
source("cam.plot14.R")The MCMC configuration (number of chains, iterations, thinning interval) is defined in a clearly labeled CONFIGURATION block at the top of each model script, and can be adjusted for your hardware and convergence requirements.
Note on data: Raw field data files are not included in this repository. Input CSVs should be placed in the corresponding analysis subfolder. Please contact the authors for data access inquiries.
- Camera traps detected 50 taxa (13 Aves, 34 Mammalia, 2 Reptilia, 1 unclassified) across 12 transects, with estimated site-level species richness ranging from approximately 30 to 43 species.
- Castanheira tree density showed a generally positive association with species richness across methods, suggesting these keystone trees function as biodiversity hotspots within the harvest landscape.
- Trail use effects were species-specific and heterogeneous — neither consistent avoidance nor attraction at the community level — indicating complex and taxon-dependent responses to human activity.
- Cross-method comparison revealed complementary detection profiles: camera traps broadly captured vertebrates, while eDNA methods detected taxa rarely or never photographed on cameras, underscoring the value of multi-method designs.
If you use this code or build on these methods, please cite:
Chen, Y. & Fragoso Lab. (2025). Wildlife Biodiversity Monitoring in the Unini River: Multi-Method, Multi-Species Bayesian Occupancy Analysis of Brazil Nut Harvesting Impacts. Results presented to Unini River communities, San Cristóbal de las Casas, Mexico, November 2025.
The traditional communities of the Unini Extractive Reserve depend on the forest for their livelihoods and cultural identity. This research exists because of their participation, knowledge, and trust. Sustainable Brazil nut harvesting — the very practice this project studies — is one of the primary ways these communities maintain their way of life while protecting the Amazon.
If you are moved by this work and would like to learn more or discuss ways to support the communities involved, please reach out:
This project was conducted in collaboration with the traditional communities of the Unini Extractive Reserve, under the supervision of Prof. José M.V. Fragoso (Fragoso Lab). Results were presented back to the Unini communities in San Cristóbal de las Casas, Mexico, November 2025 — a core part of the lab's community-based conservation approach.