-
Notifications
You must be signed in to change notification settings - Fork 1
feat: name leftover residual on period-report pair rows (v2.12.22) #530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1bd45fc
a30bb28
df18ed6
e05d63b
6fcf603
1834e7d
2ca0974
54f3f69
cb5b21f
435992d
dc508ae
a988ca6
9b0e47e
13d95e1
de4ff43
9d4ccf3
e1d2442
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| ## 2.12.22 — Leftover residual disclosure | ||
|
|
||
| - Name signed leftover residual `R = Y − E[Y|θ, item]` on leftover | ||
| post–criterion pair rows (ADR 0178). After `make seed`, closest and | ||
| farthest leftover pairs sit above the member list with `R` next to | ||
| leftover-map distance `d`; click opens that post. A non-finite | ||
| residual is an em dash, never a fabricated leftover score. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| # ADR 0178 — Disclose leftover residual on period-report pair rows | ||
|
|
||
| **Decision status:** Accepted | ||
| **Date:** 2026-08-24 | ||
|
|
||
| Amends [ADR 0049](0049-leftover-pair-report-ui.md). | ||
|
|
||
| ## Context | ||
|
|
||
| ADR 0048 already persists leftover-map distance and leftover residual | ||
| `R = Y − E[Y|θ, item]` on `report_leftover_pair`. ADR 0049 already | ||
| renders closest and farthest pairs above the member list and opens the | ||
| named post. The pair button showed only `d`, so a buyer could not tell | ||
| a large leftover response from a merely distant map pair. | ||
|
|
||
| Jeon et al. (2021, eq. 3) leftover interaction is | ||
| `−γ‖ξ_p − ζ_i‖`. Distance is that map gap. Residual is the observed | ||
| leftover *after IRT main effects* that entered the biplot. They are | ||
| different quantities. Hiding residual would keep the persisted column | ||
| as an unpublished measurement. | ||
|
|
||
| This increment does not persist leftover-map coordinates, does not name | ||
| observed `Y` / expected `E`, does not name leftover-map rank, and does | ||
| not land Post quality on the leftover criterion. No schema change: | ||
| `leftover_residual` already exists from ADR 0048 / migration `0012`. | ||
|
|
||
| The unprotected-stack ADR for the same buyer fact was 0162. This | ||
| protected-main reconstruction uses **0178** so it does not collide with | ||
| two-axis leftover-map distance (0166), leftover coverage (0168), | ||
| leftover-map axis share (0148), leftover-map rank (0172), leftover | ||
| observed Y / expected E (0177), or analysis-run status same clock | ||
| (0171). | ||
|
|
||
| ## Decision | ||
|
|
||
| Each leftover pair button shows signed leftover residual `R` with two | ||
| decimal places next to leftover-map distance `d`. Next action: leftover | ||
| residual `R` after IRT main effects; open this post to read the named | ||
| criterion. A non-finite residual renders an em dash rather than a | ||
| fabricated leftover score. Click still uses the same post-open handler | ||
| as ADR 0049. | ||
|
|
||
| ## Consequences | ||
|
|
||
| `GET /api/reports/{grouping}/{period}` already returns | ||
| `leftover_residual`. The frontend now names that value. After | ||
| `make seed`, closest and farthest leftover pairs sit above the member | ||
| list with `R` next to `d`; click opens that post. | ||
|
|
||
| ## Related | ||
|
|
||
| Independent of leftover interaction-map persistence, leftover-criterion | ||
| evaluation landing, leftover-map complete-case coverage, leftover-map | ||
| axis share, leftover pairs on the grouping comparison strip, two-axis | ||
| leftover-map distance, leftover observed `Y` / expected `E`, and | ||
| leftover-map rank. | ||
|
|
||
| ## References | ||
|
|
||
| Gabriel, K. R. (1971). The biplot graphic display of matrices with | ||
| application to principal component analysis. *Biometrika, 58*(3), | ||
| 453–467. https://doi.org/10.1093/biomet/58.3.453 | ||
|
|
||
| Jeon, M., Jin, I. H., Schweinberger, M., & Baugh, S. (2021). Mapping | ||
| unobserved item–respondent interactions: A latent space item response | ||
| model with interaction map. *Psychometrika, 86*(2), 378–403. | ||
| https://doi.org/10.1007/s11336-021-09762-5 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
| import { formatLeftoverResidual } from "./leftoverResidual"; | ||
|
|
||
| describe("formatLeftoverResidual", () => { | ||
| it("keeps a signed residual without inventing a leftover score", () => { | ||
| expect(formatLeftoverResidual(0.4)).toBe("+0.40"); | ||
| expect(formatLeftoverResidual(-1.1)).toBe("\u22121.10"); | ||
| expect(formatLeftoverResidual(0)).toBe("0.00"); | ||
| expect(formatLeftoverResidual(Number.NaN)).toBe("—"); | ||
| }); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /** Signed leftover residual ``R = Y − E[Y|θ, item]`` after IRT main effects. */ | ||
|
|
||
| export const LEFTOVER_RESIDUAL_ACTION = | ||
| "Leftover residual R {residual} after IRT main effects. Open this post to read {criterion}."; | ||
|
|
||
| export function formatLeftoverResidual(value: number): string { | ||
| if (!Number.isFinite(value)) { | ||
| return "—"; | ||
| } | ||
| const magnitude = Math.abs(value).toFixed(2); | ||
| if (value > 0) { | ||
| return `+${magnitude}`; | ||
| } | ||
| if (value < 0) { | ||
| return `\u2212${magnitude}`; | ||
| } | ||
| return magnitude; | ||
| } | ||
|
devin-ai-integration[bot] marked this conversation as resolved.
Comment on lines
+3
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Signed residual R never rendered on pair rows
Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback. |
||
Uh oh!
There was an error while loading. Please reload this page.