fix(medications): widen the medication-effect intervals to a week of lag

The automatic Newey-West rule gives a lag of 3 on 30 to 270 daily
values, which leaves most of a physiological series' carry-over out of
the intervals. The lag is now at least 7. Reference values are
recomputed with statsmodels at the new default, and the lag-3 values
stay pinned with an explicit lag. A fit whose residual autocorrelation
exceeds 0.5 is flagged, and the card, the clinician view and the PDF
say the ranges may still be too narrow.
This commit is contained in:
Marc-André Bombeck committed 2026-10-21 23:20:28 +02:00
1 parent 99dfd68aad
commit cfd7c18d48
19 files changed
+208 -31

No files matched your search

+11 -1
View File
@@ -137,7 +137,17 @@ const segmentedSchema = z
df: z.number().int(),
rSquared: z.number(),
residualAutocorrelation: z.number(),
hacLag: z.number().int(),
hacLag: z
.number()
.int()
.describe(
"Newey–West lag applied: the automatic rule, at least 7 (a week of daily carry-over).",
),
autocorrelationCaveat: z
.boolean()
.describe(
"True when the lag-1 residual autocorrelation exceeds 0.5: the carry-over is strong enough that the intervals may still be too narrow, and the read-out says so.",
),
})
.nullable(),
confounders: z.array(