mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 22:26:13 +00:00
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:
1 parent
99dfd68aad
commit
cfd7c18d48
19 files changed
+208
-31
No files matched your search
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user