Repository navigation
Biology: apparent survival in the nurseries with a Cormack–Jolly–Seber model (#42) - #139
Merged
Merged
Conversation
…r model (#42) Within-season apparent survival from capture histories: 14-day occasions at each nursery, one history per pup, nursery and season from its first capture there, capture probability from that fortnight's net-hours (cloglog, an intercept per nursery, p = 0 without a set). Likelihood-ratio tests for differences between nurseries and for transients (a separate φ in the first fortnight after tagging). - analytics/survival.ts: fitCjs (BFGS, numerical Hessian, Wald intervals on the logit scale) and survival(d, species) - survival.test.ts: recovers φ, the effort slope, nursery differences and transients from simulated histories - /recaptures: "How long do pups stay?" with the share still at each nursery 30 days later, per species - AGENTS.md: notes and repo map Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #42.
What. Within-season apparent survival from the mark–recapture histories, using a Cormack–Jolly–Seber model. It's the share of pups still at a nursery some time after a capture, whether they died or left. Unlike the Schnabel abundance, it doesn't assume a closed nursery: each history starts at the pup's first capture, so pups born later in the season don't bias it.
Model (
src/lib/server/analytics/survival.ts)p = 1 − exp(−exp(aₙ + β·log hours)). Each nursery gets its own intercept, and p = 0 in a fortnight with no set. Untimed sets count as a typical set.survival.test.tschecks the fitter on simulated histories. It recovers a shared φ and the effort slope (β ≈ 1 forp = 1 − exp(−q·h)). It separates nurseries only when their φ really differs. It detects transients. There's no R in CI, so this is the check against a known answer.What it shows on the real data (/recaptures, new "How long do pups stay?" section)
The copy says plainly that φ can't tell death from leaving, and that a pup that moves to another nursery counts as gone. The lemon transient result gets two explanations: passing through, or moving off after being handled.
Checks
pnpm lint,pnpm checkandpnpm testall pass (four new tests). The real-data import test passes.IMPORTER_VERSIONstays as it is.🤖 Generated with Claude Code