Lab 10 · When Assumptions Break: Robust Analysis & Reporting
Biological motivation
In Lab 9 you proved that unmarked::occu recovers unbiased estimates when its
assumptions are met. They are never fully met in the field. This lab is about how
to quantify and honestly report the bias introduced when an assumption is broken — and
about your responsibility, as the AI-assisted scientist, to defend your model.
The three break-it scenarios
You will pick one of the following to study in depth (or invent your own and get instructor approval):
- Closure violation. During the season, the true z[i] is not fixed: animals colonise / leave 5–25% of sites between visits. Does ψ̂ from a single-season model bias high or low?
- Heterogeneity in detection. Detection probability is not constant across sites: p ~ Beta(α, β) with mean 0.3 but a heavy tail. What does the model report when you fit constant-p?
- Classifier-induced misclassification. Your camera-trap species classifier (e.g., Lab 5) has 90% recall and 95% precision for your focal species. Detections from other species get mis-labeled into the focal class at the corresponding rate. What does the resulting occupancy estimate look like, and how does it depend on the "ambient density" of the other species?
Tasks
Task 1 — project setup (2 pts)
Continue from your Lab 9 project (or start fresh and copy your Lab 9 code in). Update
CLAUDE.md to describe which scenario you picked and the null model you'll
contrast against.
Task 2 — extend the simulator (6 pts)
Ask Claude Code to modify your Lab-9 simulate_occu() to take a parameter
controlling the assumption violation (e.g., turnover_rate,
p_dispersion, or classifier_recall + classifier_precision
+ ambient_prevalence). Carefully write the math of the violation into a comment
block at the top of the function — you must understand it, not just have Claude write
it.
Task 3 — bias sweep (4 pts)
Run 500 simulations at each of 6 levels of your violation parameter (e.g., turnover
0, 0.05, 0.1, 0.15, 0.2, 0.25). Plot mean estimated ψ vs the true ψ as a function of
the violation level (bias_plot.png), with 95% empirical envelopes.
Task 4 — pick the right alternative model (3 pts)
Choose a model that explicitly relaxes the assumption you broke (e.g., dynamic occupancy for closure violations, occupancy with a logit-normal random effect on p for heterogeneity, a measurement-error occupancy model for misclassification). Fit it to one mid-level violation dataset. Does it recover the truth?
Task 5 — write the methods + results (5 pts)
In 2 pages (no more), write the methods and results section as if for a journal supplement. Required sections:
- "Simulation setup" — precise enough to replicate.
- "Bias under assumption X" — with
bias_plot.png. - "Mitigation with model Y" — with a table of estimates.
- "Recommendation for practitioners" — in your own words, no AI.
- "Tools used" appendix — Claude Code, R packages, versions.
Rubric
| Component | Points |
|---|---|
| Project setup and CLAUDE.md | 2 |
| Extended simulator with documented math | 4 |
| Bias sweep with plot | 4 |
| Alternative model fit and comparison | 3 |
| 2-page methods + results (writing quality, honesty) | 7 |
| Total | 20 |
This lab also doubles as a final project pitch: the same scenario you studied here is a fine starting point for the final project if you want to extend it.