From cb0fc514d05a52ef037ba3602b04f5b648b92af1 Mon Sep 17 00:00:00 2001
From: luen
Date: Sun, 8 Nov 2026 17:38:46 +1000
Subject: [PATCH] Lab answers: chart statistics conventions (#132); sex-ratio
wording (#130)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- AGENTS.md and tests.ts record Jodie Rummer's choices: p < 0.05, nursery
and season as fixed effects in catch-rate tests, p-values and R² are fine
for a site that is mainly for the lab. Page-wide FDR is still open.
- /morphometrics: when nurseries differ in sex ratio, say that sex was
recorded the same way throughout and that the lab knows of no reason to
expect a difference (temperature sets sea-turtle sex; untested in sharks).
Co-Authored-By: Claude Opus 5.5
---
AGENTS.md | 1 +
src/lib/server/analytics/tests.ts | 3 +++
src/routes/morphometrics/+page.svelte | 8 ++++++++
3 files changed, 12 insertions(+)
diff --git a/AGENTS.md b/AGENTS.md
index 824eb36..fe73cb1 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -158,6 +158,7 @@ Drop the workbook in `data/` named like `Physioshark_Shark Log 2026-2027.xlsx` (
- Follow the dataviz method: categorical slots in fixed order (`--series-1…8`, validated light and dark), sequential = one hue (`--seq-*`), diverging = blue ↔ red with a neutral midpoint, one y-axis only (never dual axes), legends for ≥ 2 series, text in ink tokens (never the series colour), 4 px rounded bar ends, 2 px lines, hover tooltips, data tables via `ChartCard table`.
- Every chart registers its data with the enclosing `ChartCard` (`registerCsv` in `charts/csv.ts`), which shows **Download CSV**. A new chart component must call `registerCsv` too. An explicit `ChartCard table` takes precedence.
- Back every trend, relationship or group difference with a test (#119): compute it in the load function with `analytics/tests.ts` and pass the sentence to `ChartCard stats`. Catch rates: `rateTest`/`rateText` (negative-binomial LRT with log net-hours offset, raw and adjusted for nursery, season and day of the season; pass `skip` for the factor under test). Values across groups: `groupsText` (Kruskal–Wallis). Shares: `tableText` (χ²). One value per season: `trendText`. Scatters: `fitText` (R², p, Spearman) or `rankText`. Copy and findings that name a "best" or "highest" group must check the test first (the moon finding picked the best of eight phases, #118).
+- The lab's conventions for chart statistics (Jodie Rummer, #132): p < 0.05 is the threshold. Nursery and season are **fixed effects** in catch-rate tests ("they don't change"). p-values and R² are fine, as are effect sizes with intervals: the site is mainly for Dr Rummer and her lab, so it can stay technical. Each chart is tested on its own; Bonferroni applies only inside the correlation grids on /drivers and /pressure. Whether to also control the false discovery rate across a page is an open question on #132 (on the real data, 2 of the 73 results below 0.05 outside the grids would not survive it).
- Cite the study behind a chart with `` (ids in `src/lib/publications.ts`). Link only papers that analysed the same question with this dataset; check the abstract first. PDFs are served at `rummerlab.com/papers/` (metadata in the rummerlab-website repo, `data/papers.json`).
- Species colours come from `src/lib/species.ts` (blacktip = slot 1, sicklefin lemon = slot 2).
- Charts measure their width (`bind:clientWidth`) and carry a `viewBox` so pre-hydration renders scale down instead of overflowing.
diff --git a/src/lib/server/analytics/tests.ts b/src/lib/server/analytics/tests.ts
index e8ee926..cc3cadf 100644
--- a/src/lib/server/analytics/tests.ts
+++ b/src/lib/server/analytics/tests.ts
@@ -4,6 +4,9 @@
* with log(net-hours) as the offset, so long and short sets weigh correctly; "adjusted" adds
* nursery, season and a smooth for the day of the season, the calendar that confounds most
* comparisons (#54). Each helper returns null when there is too little data to test.
+ *
+ * The lab's conventions (#132): p < 0.05, nursery and season as fixed effects, p-values and R²
+ * shown as they are (the site is mainly for the lab). Each chart is tested on its own.
*/
import { num, pValue } from '#lib/format';
import {
diff --git a/src/routes/morphometrics/+page.svelte b/src/routes/morphometrics/+page.svelte
index abe30e4..464e910 100644
--- a/src/routes/morphometrics/+page.svelte
+++ b/src/routes/morphometrics/+page.svelte
@@ -191,6 +191,14 @@
{/if}
{/each}
+ {#if data.sexModel.some((m) => m.fit?.nurseryP != null && m.fit.nurseryP < 0.05)}
+
+ Sex was recorded the same way in every season, with claspers checked at each capture, so a
+ difference between nurseries isn't down to how sex was recorded. The lab knows of no reason
+ to expect one: nest temperature sets the sex of sea turtles, but nobody has tested whether
+ anything similar happens in sharks.
+
+ {/if}
{#each ['Cm', 'Na'] as const as sp (sp)}
{#if nurseryRows(sp).length}