Repository navigation
Charts: statistics behind every trend and difference (#119, #118, #120) - #122
Merged
Merged
Conversation
- analytics/tests.ts: negative-binomial likelihood-ratio tests of catch rates (raw and adjusted for nursery, season and day of the season, naming what was adjusted), per-group rate ratios, and worded Kruskal-Wallis, chi2, trend, linear-fit/Spearman and Welch tests. stats.ts gains kruskal and pairedT. - ChartCard `stats` line, used on the overview, seasons, nurseries, nursery profiles, morphometrics, neonates, growth, recaptures, physiology, drivers, ocean, tides, moon, time of day, pressure, effort, water quality and adults. - Moon finding (#118): names a best phase only when the phases differ beyond chance; otherwise reports no effect, as Debaere et al. (2024) did. - Overview catch rate per season (#120): adjusted season test and the seasons whose interval excludes the average (2018-19 and 2019-20 lemons). - Nursery, weekend and heat-stress findings report their tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 3, 2026
Keep both findings imports and repo-map lines. The mixed-model tests on the /morphometrics sex charts move from notes to the ChartCard stats line, and the per-nursery charts get one too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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 #119. Closes #118. Part of #120: the chart now tests the season swing; #120 stays open for the lab to say whether fieldwork changed in 2018-19.
Why
Many charts showed a trend, a relationship or a difference between groups with nothing to say whether it's real. The "Best moon for finding pups" finding picked the highest of eight raw catch rates, so it would always name some phase as best. On this dataset the phases don't differ, as Debaere et al. (2024) also found.
What
analytics/tests.tspicks the right test for each kind of chart and words it the same way everywhere:rateTest/rateText/rateSlopeTextfit negative-binomial likelihood-ratio tests on timed sets, with log(net-hours) as the offset. They report the test raw and adjusted for nursery, season and a day-of-season spline;skipleaves out the factor being tested, and the text names only what was actually adjusted for.rateEffectsgives each group's adjusted rate ratio against the average group, with a 95% interval.groupsText), χ² for shares (tableText), one-value-per-season linear trends with R² (trendText), linear fit with R² plus Spearman for scatters (fitText,rankText), and Welch's t-test (twoGroupText).stats.ts:kruskal(with the tie correction) andpairedT.ChartCard stats: a "Statistics" line under the chart, styled the same everywhere.Pages covered:
Charts that are purely descriptive (maps, calendars, logger coverage, inventories, word counts) have no test, and charts that already stated their test in a note keep it.
Findings:
Overview "Catch rate per season" (Analysis: why catch rates swing in 2018-19 (blacktips down, lemons up) #120): says whether seasons differ once nursery and day of the season are held fixed, and names the seasons whose 95% interval excludes the average.
Results on the real data (examples, all computed live)
Notes
findings.ts, a repo-map line in AGENTS.md). Whichever PR merges second needs a one-line resolution.Checks
pnpm lint,pnpm checkpnpm test: 82 passed. New tests:rateTestdetects a simulated 2× difference, finds none under the null, and labels the adjustment correctly;pnpm build && pnpm test:e2e: 31 passed, including axe in light and dark🤖 Generated with Claude Code