Skip to content

the day and the bout disagree about what counts as active #43

Description

@abdulsaheel

Calories.dailyEnergy gates active energy at a fixed fraction of HRmax
(activeFraction = 0.50). Calories.estimateBoutCalories gates at
restingHr + 0.30 * HRR. They are different quantities and they disagree, so
the same minute of the same day is billed active by one and resting by the
other:

profile HRmax day gate bout gate apart
70 y, RHR 68 159.0 79.5 95.3 +15.8
34 y, RHR 55 184.2 92.1 93.8 +1.7
25 y, RHR 45 190.5 95.2 88.7 -6.6

Note the sign flips. It is not a constant offset one path could absorb.

The fixed fraction runs the wrong way

0.50 * Tanaka is 104 - 0.35*age, so it falls with age while resting HR
generally does not. Measured against rest rather than against HRmax:

  • 70 y with RHR 68: the gate sits 11.5 bpm above rest. Standing up,
    digesting a meal, a stressful phone call all clear it, so the day accrues
    active surplus from existing.
  • 25 y with RHR 45: the gate sits 50.2 bpm above rest. Real walking at
    HR 90 bills zero active energy.

So it over-counts the old and deconditioned and under-counts the young and fit.

Published HR-FLEX (Spurr 1988; Ceesay 1989) determines FLEX individually, as
the midpoint between the highest resting HR and the lowest HR during light
imposed exercise. It is individual precisely because a fixed threshold does not
transfer between people.

Keytel is at its most non-linear right at that gate

Male, 34 y, 72 kg at HR 92 (about the flex point):

-55.0969 + 0.6309*92 + 0.1988*72 + 0.2017*34 = 24.1173 kJ/min
                                             =  5.764 kcal/min  (~4.6 METs)

HR 92 in a 34-year-old is light walking, roughly 3 METs. The model over-reads by
about 60% exactly where the gate opens. Mifflin basal is 1.158 kcal/min, so
~4.6 kcal/min of "active surplus" is credited for every minute of
near-sedentary time
that clears the threshold. On the older profile above,
where the gate is 11.5 bpm over rest, that is a lot of minutes.

This is a larger error source than anything else currently in the calorie path.

Proposal

One gate, HRR-relative, shared by both entry points — the bout form is the
better of the two, and it at least scales with the individual's own resting HR.
Then look separately at whether the low-HR end of Keytel should be blended
toward the resting rate rather than switching at a hard threshold, since the
discontinuity at the gate is where the over-read concentrates.

Changing this moves persisted numbers, so it needs a kAlgoVersion bump on the
edge side and a note that historical days will shift.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions