mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 21:32:18 +00:00
fix(insights): correlate residuals, not the calendar
Two daily series that both follow the season (temperature and blood pressure, daylight and sleep) correlated strongly with nothing between them. In a seeded simulation of such a pair the engine surfaced a finding in 58 % of 400-day runs and 30 % of 180-day runs, and a real next-day effect under the season came back with the wrong sign. Every daily pair now goes through seasonallyAdjustedPearson: a linear trend and one annual harmonic are removed from both series (trend only under 120 paired days), the residuals are correlated, and the p-value uses the Pyper-Peterman effective sample size. Shrinkage and the phrasing tier read the effective size too. BH-FDR and the effect floor are unchanged. Pairs too short to fit the basis are not tested. The weather channels are tested once over the mean of the day before and the day itself against the same day's outcome (lagDays 0), which pairs the overnight low with the night it shaped now that sleep is keyed on the wake day. Discovered pairs carry an additive nEff, the same-day templates are wired, and the matrix skips the weather read when the environment module is off. scripts/compare-correlation-findings.ts counts findings per account before and after, read-only, for the release-candidate dry run.
This commit is contained in:
1 parent
70dc7dd24f
commit
aca497d9ac
20 files changed
+1751
-95
No files matched your search
+13
-4
@@ -34740,6 +34740,9 @@ components:
|
||||
type: integer
|
||||
minimum: -9007199254740991
|
||||
maximum: 9007199254740991
|
||||
nEff:
|
||||
description: v1.42 — effective sample size after serial correlation, ≤ `n`; the p-value uses it.
|
||||
type: number
|
||||
r:
|
||||
type: number
|
||||
pValue:
|
||||
@@ -62417,13 +62420,18 @@ components:
|
||||
type: integer
|
||||
minimum: -9007199254740991
|
||||
maximum: 9007199254740991
|
||||
description: Paired-day count after the day+1 lag join (≥ 20).
|
||||
description: Paired-day count after the lag join (≥ 20).
|
||||
nEff:
|
||||
description: v1.42 — effective sample size after serial correlation (Pyper–Peterman), ≤ `n`. The p-value, the shrinkage
|
||||
and the tier use it.
|
||||
type: number
|
||||
r:
|
||||
type: number
|
||||
description: Pearson r over the lag-joined daily series.
|
||||
description: "Pearson r over the lag-joined daily series, computed on residuals: a linear trend (and, from 120 paired
|
||||
days, one annual harmonic) is removed from both series first (v1.42)."
|
||||
pValue:
|
||||
type: number
|
||||
description: Two-sided exact Student-t p-value (< 0.05).
|
||||
description: Two-sided exact Student-t p-value (< 0.05) at the effective sample size.
|
||||
qValue:
|
||||
type: number
|
||||
description: Benjamini-Hochberg FDR-adjusted q-value (≤ the surface threshold).
|
||||
@@ -62446,7 +62454,8 @@ components:
|
||||
type: integer
|
||||
minimum: -9007199254740991
|
||||
maximum: 9007199254740991
|
||||
description: Lag in days applied (1).
|
||||
description: "Lag in days applied: 1 = behaviour day, outcome the next day; 0 = the environmental channels, whose
|
||||
exposure is the mean of the day before and the day itself, paired with the same day's outcome (v1.42)."
|
||||
window:
|
||||
description: v1.22 — which window surfaced the pair. Absent on the 180-day scan (retrospective default); `recent` for an
|
||||
emerging early-detection pair.
|
||||
|
||||
Reference in new issue
Block a user