# Initial Nutrition Recommendation Algorithm

*Research and product logic proposal (v0.1 — 23 July 2026)*

## Executive decision

Use the **2023 National Academies Estimated Energy Requirement (EER) equations** as the default initial estimate of total daily energy expenditure for eligible adults. These equations predict total expenditure directly from age, height, weight, equation sex, and physical activity category. They were developed from a large doubly labelled water dataset and are more appropriate for this onboarding flow than estimating resting metabolism and applying a generic activity multiplier.

Use **Mifflin–St Jeor** as a transparent cross-check. Use **Cunningham** only when the user has a credible fat-free-mass measurement. Accept **measured resting metabolic rate from indirect calorimetry** as an expert override. Treat **doubly labelled water** as the scientific reference standard, not a consumer onboarding method.

The product should present the initial result as an estimate with a range, not a fact:

> “Your starting maintenance estimate is 2,400 kcal/day. A plausible range is 2,150–2,650. We will refine this after you validate enough food and weight data.”

For the four first-class goals:

| Goal | Default starting target | Plausible starting range | Primary outcome |
|---|---:|---:|---|
| Lose | 0.5% of body weight per week | 0.25–1.0% per week; cap the starting deficit at 20% of TDEE or 750 kcal/day | Downward weight trend while preserving performance and lean mass |
| Maintain | Estimated maintenance | A weight-stability band and detailed adjustment rules remain proposed pending product and clinical validation | Broadly stable weight without implying recomposition |
| Gain | 5–10% above TDEE, based on training experience | 5–15% above TDEE; usually no more than 500 kcal/day initially | 0.1–0.5% body weight gain per week |
| Recomposition | Estimated maintenance | Maintenance to a 5–10% deficit when fat loss is the explicit priority | Stable or slowly falling weight alongside improved measurements and resistance-training performance |

The app should **not silently change a target**. It should validate data first, state its evidence and confidence, and offer one change that the user can accept, defer, or reject.

## Scope and safety boundary

The initial automated algorithm is for generally healthy, nonpregnant, nonlactating adults. Version 1 should not generate an automatic calorie target for any goal—including Lose, Maintain, Gain, or Recomposition—when any of the following apply:

- age below 19;
- pregnancy or breastfeeding;
- current or target BMI below 18.5;
- a disclosed eating disorder or active eating-disorder treatment;
- bariatric surgery, dialysis, severe kidney or liver disease, uncontrolled thyroid disease, or another condition that materially changes energy or protein needs;
- medication-driven weight change that requires clinical monitoring;
- a requested target below the product’s unsupervised intake floor.

In these cases, the product can still support neutral food logging with a manual target. It must not show an automated neutral maintenance estimate as a fallback, and should direct the user to a qualified clinician for recommendations. The [NIH Body Weight Planner](https://www.niddk.nih.gov/bwp.) similarly limits its information to adults and excludes pregnancy and breastfeeding.

The app is estimating population-level energy requirements. It is not diagnosing metabolism or replacing individual medical care.

## Required onboarding inputs

The calculation needs:

1. age;
2. height in centimetres;
3. current weight in kilograms;
4. **sex used by the energy equation**;
5. goal: lose, maintain, gain, or recomposition;
6. activity category from Apple Health or a manual activity assessment;
7. goal destination: landing weight for Lose, Maintain, and Gain, or optional landing body-fat percentage for Recomposition;
8. goal-specific pace or preference, where applicable, or the app default;
9. training experience for a gain goal;
10. whether the user performs progressive resistance training for a recomposition goal;
11. optional measured resting metabolic rate;
12. optional fat-free mass and its measurement source;
12. safety-screen answers.

The onboarding flow asks for “sex used for this energy estimate.” The scientific equations were validated in male and female groups and require a sex-specific coefficient. The UI should not treat gender identity as a metabolic variable. Explain why the estimate needs this input, allow manual calorie targets, and keep the field private.

After a separate, contextual Apple Health permission request, onboarding may prefill available height, weight, and recent activity or workout context. Every imported value remains editable and requires confirmation. Missing, denied, or limited data falls back to manual entry. Continue with Apple does not grant Apple Health access, and the private equation-sex input is never silently populated from Apple Health.

Manual weight entry uses one direct numeric field with the decimal keypad and a clear, visible kg/lb control. Number display and decimal separators follow the person’s locale. The field permits partial input while editing, then validates plausible range, precision, and unit conversion on commit. Rejected wheel-picker and hybrid-value concepts do not appear as alternatives in onboarding.

## What expenditure means

Total daily energy expenditure (TDEE) includes:

- resting or basal energy expenditure;
- the thermic effect of food;
- structured exercise;
- non-exercise activity such as walking, standing, and daily work.

For a weight-stable adult, average TDEE approximates the energy intake required to maintain current weight. Daily expenditure varies, so the initial recommendation should represent a practical daily average.

## Five scientifically backed methods

These are not five equally interchangeable formulas. They cover the evidence hierarchy from direct free-living measurement to practical population prediction.

### 1. Doubly labelled water

**What it calculates:** Average free-living total energy expenditure across roughly 7–14 days.

**How it works:** The person drinks water containing stable isotopes of hydrogen and oxygen. Their different disappearance rates allow researchers to estimate carbon dioxide production and convert it to energy expenditure.

**Scientific basis:** The 2023 National Academies report calls doubly labelled water the “benchmark standard” for free-living TDEE. The method has been validated against calorimetry and does not constrain normal activity. [National Academies, 2023](https://www.ncbi.nlm.nih.gov/books/NBK591021/); [Lam and Ravussin, 2016](https://pmc.ncbi.nlm.nih.gov/articles/PMC5081410/)

**Strength:** Best available objective measurement of average free-living TDEE.

**Limitation:** Expensive, specialised, retrospective, and unavailable during normal app onboarding.

**Product role:** Scientific reference for validating the product’s population model. If a user has a recent clinician-provided DLW result, accept it as a high-confidence maintenance override.

### 2. Indirect calorimetry

**What it calculates:** Resting energy expenditure, not full daily expenditure.

**How it works:** A metabolic cart measures oxygen consumption and carbon dioxide production under controlled resting conditions. Gas exchange is converted to resting energy expenditure.

**Scientific basis:** Indirect calorimetry is the reference method for measuring resting expenditure. [Lam and Ravussin, 2016](https://pmc.ncbi.nlm.nih.gov/articles/PMC5081410/)

**Strength:** Measures the individual’s resting expenditure instead of predicting it from population averages.

**Limitation:** Test preparation and equipment quality matter. The result still needs an activity estimate to become TDEE.

**Product calculation:**

```text
measured_TDEE = measured_RMR × representative_PAL
```

Use representative physical activity levels of 1.40, 1.60, 1.75, and 2.00 for inactive, low active, active, and very active respectively. Present a range because RMR × PAL is still an estimate of free-living TDEE.

**Product role:** Optional expert override. Do not make it an onboarding requirement.

### 3. 2023 National Academies EER equations

**What they calculate:** Total daily energy expenditure directly for weight-stable adults.

**How they work:** Sex-specific regression equations use age, height, weight, and one of four physical activity categories. The equations were developed from a combined dataset containing 8,600 doubly labelled water observations across life stages.

For adults aged 19 years and above:

```text
Men
Inactive:    753.07 − 10.83×age + 6.50×height_cm + 14.10×weight_kg
Low active:  581.47 − 10.83×age + 8.30×height_cm + 14.94×weight_kg
Active:     1004.82 − 10.83×age + 6.52×height_cm + 15.91×weight_kg
Very active:−517.88 − 10.83×age + 15.61×height_cm + 19.11×weight_kg

Women
Inactive:    584.90 − 7.01×age + 5.72×height_cm + 11.71×weight_kg
Low active:  575.77 − 7.01×age + 6.60×height_cm + 12.14×weight_kg
Active:      710.25 − 7.01×age + 6.54×height_cm + 12.34×weight_kg
Very active: 511.83 − 7.01×age + 9.07×height_cm + 12.56×weight_kg
```

The adult models reported mean absolute percentage errors of 9.4% for men and 8.7% for women, with mean absolute errors of 266 and 191 kcal/day respectively. [National Academies adult equation table](https://www.ncbi.nlm.nih.gov/books/NBK591021/table/tab_5_5/?report=objectonly)

**Strength:** It predicts the value the app needs—TDEE—directly. It is recent, transparent, based on objective free-living measurements, and designed for the same age, height, weight, sex, and activity inputs collected during onboarding.

**Limitation:** It remains a population estimate. Activity category can be misclassified, and individual error of several hundred calories is plausible.

**Product role:** Default initial maintenance estimate.

### 4. Mifflin–St Jeor

**What it calculates:** Resting energy expenditure.

**How it works:** It predicts resting expenditure from weight, height, age, and sex. The original study included 498 adults and compared the equation with indirect calorimetry.

```text
Men:   RMR = 10×weight_kg + 6.25×height_cm − 5×age + 5
Women: RMR = 10×weight_kg + 6.25×height_cm − 5×age − 161

TDEE cross-check = RMR × representative_PAL
```

The original paper reported that the older Harris–Benedict equations overestimated measured resting expenditure by about 5% in its sample. A later systematic review found Mifflin–St Jeor the most reliable of four commonly used RMR equations, although no equation is accurate for every individual. [Mifflin et al., 1990](https://doi.org/10.1093/ajcn/51.2.241); [Frankenfield et al., 2005](https://pubmed.ncbi.nlm.nih.gov/15883556/)

**Strength:** Simple, transparent, widely recognised, and usable with the minimum onboarding inputs.

**Limitation:** It predicts RMR, not TDEE. Multiplying it by a broad activity factor compounds uncertainty.

**Product role:** Cross-check the National Academies estimate and support explanation. Do not average two estimates merely because both exist.

### 5. Cunningham

**What it calculates:** Resting energy expenditure from fat-free mass.

**How it works:**

```text
RMR = 500 + 22×fat_free_mass_kg
TDEE cross-check = RMR × representative_PAL
```

Cunningham derived the equation by reanalysing classic metabolism data. A later study found it performed well in recreational athletes aged 18–35 when fat-free mass was measured. [Cunningham, 1980](https://pubmed.ncbi.nlm.nih.gov/7435418/); [ten Haaf and Weijs, 2014](https://pmc.ncbi.nlm.nih.gov/articles/PMC4183531/)

**Strength:** It accounts for the strong relationship between fat-free mass and resting expenditure, making it useful for unusually muscular users.

**Limitation:** The result is only as good as the fat-free-mass input. Consumer scales can introduce enough error to erase the expected advantage. It also predicts RMR, not TDEE.

**Product role:** Optional athlete cross-check when fat-free mass comes from a credible method and has a measurement date. Never infer that a more complex equation is automatically more accurate.

## Methods not selected as defaults

### Harris–Benedict

Harris–Benedict is historically important and scientifically published, but it predicts resting expenditure and still needs a separate activity multiplier. Mifflin–St Jeor provides a stronger practical fallback, while the 2023 National Academies equations predict TDEE directly from newer free-living data. Keep Harris–Benedict in offline validation, not in the customer-facing calculation.

### Katch–McArdle

Katch–McArdle is popular in fitness calculators, but Cunningham provides a clearer peer-reviewed fat-free-mass equation and athlete validation. Supporting both would create apparent precision without solving body-composition measurement error.

### Wearable calories as the answer

Apple Health stores active energy and Apple Watch records it automatically. However, wrist wearables estimate rather than measure energy expenditure, and validation research reports substantial variation in calorie error. [Apple HealthKit documentation](https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifier/activeenergyburned); [Apple Watch accuracy review](https://pmc.ncbi.nlm.nih.gov/articles/PMC12823594/)

Use wearable data to improve activity classification and detect sustained changes. Do not add “exercise calories” to a target already based on an activity-adjusted TDEE; that would double count activity.

## Proposed initial calculation

### Step 1: validate eligibility and inputs

Reject impossible values and require confirmation for unusual but plausible values. Convert all units before calculation.

```text
age_years
height_cm
weight_kg
equation_sex ∈ {male, female}
goal ∈ {lose, maintain, gain, recomp}
activity_category ∈ {inactive, low_active, active, very_active}
```

Run the safety boundary before showing a recommended target. When automation is not appropriate, return the manual-only path without calculating or displaying an automated maintenance estimate.

### Step 2: classify activity

The National Academies define adult PAL categories as:

| Category | PAL range |
|---|---:|
| Inactive | 1.00 to <1.53 |
| Low active | 1.53 to <1.68 |
| Active | 1.68 to <1.85 |
| Very active | 1.85 to <2.50 |

Source: [National Academies PAL table](https://www.ncbi.nlm.nih.gov/books/NBK591021/table/tab_5_4/?report=objectonly)

#### With Apple Health

Use the previous 14 days when at least 10 days contain plausible resting and active energy coverage:

```text
MSJ_RMR = Mifflin–St Jeor result
device_PAL_day = (Apple_resting_energy + Apple_active_energy) / MSJ_RMR
device_PAL = median(device_PAL_day across valid days)
```

Map the median to the National Academies category ranges. Use the category—not the raw wearable calorie total—in the primary EER equation.

Ask the user to confirm the category when:

- fewer than 10 valid days exist;
- the result is below 1.0 or above 2.5;
- device data and the user’s description differ by more than one category;
- recent illness, travel, a new training block, or poor device wear makes the period unrepresentative.

#### Without Apple Health

Ask about normal work, transport, steps if known, and structured training. Show descriptions instead of labels alone:

- **Inactive:** mostly seated work and little activity beyond daily living;
- **Low active:** regular walking or light exercise in addition to daily living;
- **Active:** substantial walking or regular moderate-to-vigorous training;
- **Very active:** high-volume training or a physically demanding job in addition to daily living.

Because manual classification is uncertain, the result begins at low confidence.

### Step 3: calculate maintenance

```text
maintenance_raw = NASEM_2023_EER(
  age,
  height_cm,
  weight_kg,
  equation_sex,
  activity_category
)

maintenance_display = round_to_nearest_25(maintenance_raw)
uncertainty = max(200, 0.10 × maintenance_raw)
maintenance_range = maintenance_raw ± uncertainty
```

The 10% band reflects the model’s reported mean absolute percentage error; it is an uncertainty band, not a guarantee or individual confidence interval.

### Step 4: cross-check

```text
msj_tdee = MSJ_RMR × representative_PAL(activity_category)
gap = abs(maintenance_raw − msj_tdee) / maintenance_raw
```

Representative PAL values:

| Category | Cross-check PAL |
|---|---:|
| Inactive | 1.40 |
| Low active | 1.60 |
| Active | 1.75 |
| Very active | 2.00 |

- If the gap is at most 15%, keep the National Academies estimate.
- If the gap exceeds 15% or 350 kcal/day, do not average the estimates. Mark confidence low, ask the user to review activity, and show the wider of the two ranges.
- If a credible indirect calorimetry result exists, use measured RMR × PAL as the primary estimate and keep the equation result as context.
- If credible fat-free mass exists, calculate Cunningham as an additional athlete check. Do not let a consumer body-fat estimate silently override the primary result.

### Step 5: calculate the goal target

Use the unrounded maintenance estimate for calculations. Round the final customer-facing target to the nearest 25 kcal.

## Goal destination semantics

The landing destination describes where the person wants the plan to lead. It does not directly set the calorie target.

- **Lose:** landing weight must be below current confirmed weight. Apply the target-BMI safety boundary. The chosen destination may support progress presentation or a provisional timeline, but it never increases the starting deficit beyond the selected pace, intake floor, or deficit cap.
- **Maintain:** default the landing weight near current confirmed weight. If the person selects a materially lower or higher destination, ask them to choose Lose or Gain. The exact maintenance destination band remains part of the unresolved Maintain model.
- **Gain:** landing weight must be above current confirmed weight. It may support progress presentation, but it never increases the starting surplus beyond the experience-based percentage and 500 kcal/day cap.
- **Recomposition:** landing body-fat percentage is an optional, user-provided progress reference. It requires a current estimate and measurement source, is compared only with compatible future measurements, and never drives the calorie formula.

The app must not claim that a destination will be reached by a date. Any future timeline must state its assumptions and update from validated evidence. Slider and direct entry represent one synchronized value; direct entry reruns goal-direction and safety validation and cannot bypass a manual-only outcome.

Body-fat slider bounds require product and clinical validation. Until approved, the slider and confirmation action remain disabled and “Set later and continue” stores an explicit deferred state. The app must not infer body fat or diagnose whether a selected percentage is healthy.

## Goal logic: maintain

Maintain is a first-class onboarding goal. For eligible users, begin at the rounded maintenance estimate with no deficit or surplus:

```text
maintain_target = round_to_nearest_25(maintenance_raw)
```

The detailed weight-stability band, persistence threshold, and weekly adjustment cadence remain a product proposal pending clinical and product validation. Until those rules are confirmed, the app should not imply that Maintain and Recomposition are interchangeable: Maintain targets weight stability, while Recomposition adds training-led body-composition intent and supporting evidence.

## Goal logic: lose

### Calculation

Default to 0.5% of current body weight per week.

```text
requested_weekly_loss_kg = weight_kg × requested_loss_rate
rate_based_deficit = requested_weekly_loss_kg × 7700 / 7

deficit = min(
  rate_based_deficit,
  0.20 × maintenance_raw,
  750
)

loss_target = round_to_nearest_25(maintenance_raw − deficit)
```

Allowed pace: 0.25–1.0% of body weight per week. For lean or performance-focused users, default to 0.25–0.5%. Never use the top of the range merely because the user selects “fast.”

Apply an unsupervised floor:

- 1,200 kcal/day for the female equation;
- 1,500 kcal/day for the male equation.

If the calculated target falls below the floor, reduce the deficit and extend the timeline. If the user wants a lower target, require clinician involvement rather than a warning that can be dismissed.

These floors are a conservative product policy derived from calorie ranges used in adult weight-management guidance, not universal physiological thresholds. A dietitian and medical safety reviewer should approve them before launch. [AHA/ACC/TOS guideline](https://pmc.ncbi.nlm.nih.gov/articles/PMC5819889/)

### How it works

The algorithm converts a desired weekly weight-change rate to an approximate energy deficit, then limits that deficit to a moderate percentage of estimated maintenance. The 7,700 kcal/kg conversion is a starting approximation. It does not assume every kilogram lost is pure fat or that energy expenditure remains static.

### Why this logic

Clinical guidelines support approximately 500–750 kcal/day deficits for many adults with overweight or obesity. Sports-nutrition evidence supports slower loss for leaner, resistance-trained people to better preserve fat-free mass. A target of 0.5–1.0% body weight per week is commonly proposed for resistance-trained athletes, with evidence favouring the slower end when lean-mass retention matters. [AHA/ACC/TOS guideline](https://pmc.ncbi.nlm.nih.gov/articles/PMC5819889/); [Garthe et al., 2011](https://pubmed.ncbi.nlm.nih.gov/21558571/); [Optimal Fat Loss Phase in Resistance-Trained Athletes, 2021](https://pmc.ncbi.nlm.nih.gov/articles/PMC8471721/)

The traditional 7,700 kcal/kg rule becomes inaccurate over time because weight change alters expenditure, tissue composition varies, and the body adapts. The NIH Body Weight Planner uses a dynamic model for this reason. [NIDDK model research](https://www.niddk.nih.gov/research-funding/at-niddk/labs-branches/laboratory-biological-modeling/integrative-physiology-section/research/body-weight-planner); [Energy Content of Weight Loss, 2013](https://pmc.ncbi.nlm.nih.gov/articles/PMC3810417/)

### Supporting protein target

- Default: 1.6 g/kg/day using goal weight.
- Resistance-trained or lean users in a deficit: offer 1.8–2.2 g/kg/day.
- When credible fat-free mass exists: 2.3 g/kg FFM/day is a defensible lower-end athlete target during restriction.

Higher protein and resistance training help preserve lean mass during energy restriction, but the product should not promise preservation. [Hector and Phillips: Protein during athletic weight loss](https://pubmed.ncbi.nlm.nih.gov/25014731/); [Longland et al., 2016](https://doi.org/10.3945/ajcn.115.119339)

## Goal logic: gain

### Calculation

Ask for resistance-training experience:

| Experience | Default surplus | Target gain |
|---|---:|---:|
| Novice: less than 1 consistent year | 10% | 0.25–0.5% body weight/week |
| Intermediate: 1–3 consistent years | 7.5% | 0.15–0.3% body weight/week |
| Advanced: more than 3 consistent years | 5% | 0.1–0.25% body weight/week |

```text
surplus_percent = experience_default
surplus_kcal = min(surplus_percent × maintenance_raw, 500)
gain_target = round_to_nearest_25(maintenance_raw + surplus_kcal)
```

Allow 5–15% as the normal product range. A user can choose a slower pace. Do not automatically start at a 20% surplus.

### How it works

The app begins with a modest percentage of maintenance rather than pretending that a fixed calorie surplus maps cleanly to muscle gain. It then watches the validated weight trend and reduces or increases the target in small steps.

### Why this logic

A review of natural bodybuilding recommendations proposes a 10–20% surplus and roughly 0.25–0.5% body weight gain per week for novice and intermediate athletes, with more conservative targets for advanced athletes. The product starts at the low end because a larger surplus does not guarantee faster muscle growth and can increase unwanted fat gain. [Iraki et al., 2019](https://pubmed.ncbi.nlm.nih.gov/31247944/)

The 7,700 kcal/kg shortcut is even less suitable for predicting gain because the proportions of fat, lean tissue, glycogen, and water vary. Observed rate is more useful than a theoretical conversion.

### Supporting protein target

Set 1.6 g/kg/day by default and allow 1.6–2.2 g/kg/day. A large meta-analysis found a breakpoint near 1.62 g/kg/day for additional fat-free-mass gains during resistance training, with an upper confidence range near 2.2 g/kg/day. [Morton et al., 2018](https://pmc.ncbi.nlm.nih.gov/articles/PMC5867436/)

## Goal logic: recomposition

### Calculation

Default to maintenance:

```text
recomp_target = round_to_nearest_25(maintenance_raw)
target_weight_rate = 0% per week
acceptable_weight_band = ±0.25% body weight per week
```

When the user explicitly prioritises fat loss, performs progressive resistance training, and is not blocked by a safety rule, offer a small 5–10% deficit:

```text
recomp_target_fat_priority =
  round_to_nearest_25(maintenance_raw × 0.90 to 0.95)
```

Do not offer a surplus under the label “recomposition.” If the user is lean, highly trained, and primarily wants more muscle, recommend the conservative gain path instead.

### How it works

The calorie target keeps body weight broadly stable or slowly falling. Protein and progressive resistance training provide the muscle-retention or muscle-gain stimulus. The app evaluates progress through weight trend, measurements, photos, and training performance rather than body weight alone.

### Why this logic

There is no universally validated “recomposition calorie equation.” Recomposition has been observed across trained and untrained populations, but outcomes depend on training status, starting body composition, programme quality, protein, sleep, and measurement method. A calorie target alone cannot guarantee simultaneous fat loss and muscle gain.

Maintenance is therefore the least assumptive default. A small deficit is reasonable when fat loss is the priority. High-protein energy-deficit trials show that lean mass gain can occur under intensive resistance training, but those results should not be generalised into a promise for every user. A small 2026 trial in 30 young, predominantly male, resistance-trained participants reported recomposition at both maintenance and a 250 kcal deficit; its size and population limit generalisation. [Barakat et al., 2020](https://doi.org/10.1519/SSC.0000000000000584); [Longland et al., 2016](https://doi.org/10.3945/ajcn.115.119339); [Vargas-Molina et al., 2026](https://doi.org/10.1007/s00421-026-06209-6)

### Supporting protein target

Set 1.6 g/kg/day by default and allow 1.6–2.2 g/kg/day. If the user does no resistance training, explain that the app can support maintenance and protein consistency but cannot credibly recommend “recomposition” from calories alone.

## Adaptive calibration after onboarding

The initial equation is a prior. The user’s validated intake and weight trend should eventually carry more weight.

### Minimum evidence before adjustment

Do not adjust during the first 21 days. From day 22 onward, calculate over a rolling 21-day window only when:

- all 21 days are marked complete or corrected with a total intake;
- at least 10 body-weight observations exist;
- at least one weight exists in both the first and final four days;
- the user has reviewed suspicious or incomplete days;
- no declared illness, travel, medication change, or major device gap makes the window unrepresentative.

An intentionally untracked or incomplete day is not a zero-calorie day. It blocks quantitative expenditure calibration for that window unless the user later adds a corrected total. The Weekly Reflection can still provide a qualitative insight, but it must keep the calorie target unchanged.

### Weight trend

Use a robust trend rather than start and end weights:

1. calculate a seven-day exponentially weighted weight trend;
2. fit a robust linear slope across the 21-day trend;
3. express the slope in kilograms per day and percent body weight per week.

This reduces—but does not remove—noise from hydration, sodium, glycogen, digestion, and menstrual-cycle-related fluid shifts.

### Observed expenditure estimate

```text
observed_TDEE =
  average_complete_day_intake
  − (7700 × weight_trend_slope_kg_per_day)
```

Examples:

- Losing 0.05 kg/day while eating 2,000 kcal suggests approximately  
  `2,000 − (7,700 × −0.05) = 2,385 kcal/day`.
- Gaining 0.02 kg/day while eating 2,700 kcal suggests approximately  
  `2,700 − (7,700 × 0.02) = 2,546 kcal/day`.

Use this as a noisy calibration observation, not a physiological truth.

### Update rule

```text
observed_TDEE_clamped =
  clamp(observed_TDEE, 0.75×current_TDEE, 1.25×current_TDEE)

candidate_TDEE =
  0.75×current_TDEE + 0.25×observed_TDEE_clamped

new_TDEE =
  clamp(candidate_TDEE, current_TDEE−100, current_TDEE+100)
```

Recalculate the goal target from `new_TDEE`, then cap the proposed weekly calorie change at the smaller of:

- 100 kcal/day;
- 5% of the current target.

This smoothing and cap are product-control choices, not published physiological constants. They prevent normal short-term noise from producing large recommendations. They must be validated in product testing.

### Goal-specific adjustment

#### Lose

- If the validated trend is within ±0.15 percentage points of the selected weekly rate, keep the target.
- If loss is slower for two valid windows, propose a 50–100 kcal reduction.
- If loss is faster than selected, recovery is poor, or the intake floor would be crossed, propose an increase.

#### Maintain

- The detailed adjustment rule remains proposed pending product and clinical validation.
- The current proposal is to keep the target while the validated weight trend remains within a symmetric stability band, and to require persistent movement outside that band before proposing a small correction.
- Until the band and persistence threshold are confirmed, do not generate an automatic Maintain adjustment; show the evidence and keep the current target.

#### Gain

- If gain is within the experience-based target band, keep the target.
- If weight is flat for two valid windows, propose a 50–100 kcal increase.
- If gain exceeds the band, propose a 50–100 kcal reduction.

#### Recomposition

- Do not change calories from one week of scale data.
- Review at 28 days.
- Keep maintenance when weight is within ±0.25% per week and measurements or performance improve.
- If weight falls faster than 0.25% per week or performance/recovery declines, propose an increase.
- If weight rises faster than 0.25% per week without supportive measurement changes, propose a small reduction.

## Recommendation confidence

| Level | Evidence |
|---|---|
| Low | Equation plus manual activity, insufficient validated intake/weight data, or cross-check gap above 15% |
| Medium | Equation plus credible Apple Health activity classification, or one valid 21-day calibration window |
| High | At least two valid calibration windows with consistent direction and no major data-quality flags |

“High” means high confidence in the product’s estimate relative to available user data. It does not mean clinical certainty.

Every recommendation should expose:

- current target;
- proposed target;
- included and excluded dates;
- weight trend and selected goal pace;
- average intake on complete days;
- estimated TDEE and uncertainty;
- reason for the change;
- confidence;
- accept, defer, reject, and manual-edit actions;
- an undo path.

## Pseudocode

```text
function initialRecommendation(user):
    if not eligibleForAutomaticRecommendation(user):
        return manualOnlyWithSafetyExplanation()

    activity = classifyActivity(user.appleHealth, user.manualActivity)

    nasemTDEE = calculateNASEM2023(
        user.equationSex,
        user.age,
        user.heightCm,
        user.weightKg,
        activity.category
    )

    msjRMR = calculateMifflin(
        user.equationSex,
        user.age,
        user.heightCm,
        user.weightKg
    )
    msjTDEE = msjRMR * representativePAL(activity.category)

    confidence = activity.confidence
    uncertainty = max(200, nasemTDEE * 0.10)

    if relativeGap(nasemTDEE, msjTDEE) > 0.15:
        confidence = LOW
        uncertainty = widerRange(nasemTDEE, msjTDEE)

    maintenance = nasemTDEE

    if user.hasCredibleMeasuredRMR:
        maintenance = user.measuredRMR * representativePAL(activity.category)
        confidence = MEDIUM

    if user.goal == LOSE:
        target = calculateLossTarget(maintenance, user)
    else if user.goal == MAINTAIN:
        target = round25(maintenance)
    else if user.goal == GAIN:
        target = calculateGainTarget(maintenance, user)
    else:
        target = calculateRecompTarget(maintenance, user)

    target = applySafetyFloors(target, user)

    return Recommendation(
        maintenance = round25(maintenance),
        maintenanceRange = uncertainty,
        calorieTarget = round25(target),
        proteinTarget = calculateProteinTarget(user),
        method = selectedMethod,
        activityCategory = activity.category,
        confidence = confidence,
        explanation = buildExplanation(user, evidence),
        manualOverrideAvailable = true
    )
```

## Worked examples

### Example A: 35-year-old man, 180 cm, 80 kg, low active

```text
NASEM maintenance
= 581.47 − (10.83×35) + (8.30×180) + (14.94×80)
= 2,891.62 kcal/day
Display: 2,900 kcal/day

Mifflin RMR
= (10×80) + (6.25×180) − (5×35) + 5
= 1,755 kcal/day

Mifflin cross-check
= 1,755×1.60
= 2,808 kcal/day

Gap: 2.9%; estimates agree within the product threshold.
```

Goal outputs:

- Lose at 0.5%/week: rate-based deficit = 440 kcal/day; target ≈ **2,450 kcal/day**.
- Gain as a novice at +10%: target ≈ **3,175 kcal/day**.
- Recomposition: target ≈ **2,900 kcal/day**.
- Default gain/recomposition protein at 1.6 g/kg: **128 g/day**.

### Example B: 35-year-old woman, 165 cm, 65 kg, low active

```text
NASEM maintenance
= 575.77 − (7.01×35) + (6.60×165) + (12.14×65)
= 2,208.52 kcal/day
Display: 2,200 kcal/day

Mifflin RMR
= (10×65) + (6.25×165) − (5×35) − 161
= 1,345.25 kcal/day

Mifflin cross-check
= 1,345.25×1.60
= 2,152.4 kcal/day

Gap: 2.5%; estimates agree within the product threshold.
```

Goal outputs:

- Lose at 0.5%/week: rate-based deficit ≈ 358 kcal/day; target ≈ **1,850 kcal/day**.
- Gain as an intermediate at +7.5%: target ≈ **2,375 kcal/day**.
- Recomposition: target ≈ **2,200 kcal/day**.
- Default gain/recomposition protein at 1.6 g/kg: **104 g/day**.

## Product explanation templates

### Initial estimate

> “We estimated maintenance at 2,400 kcal/day from your age, height, weight, and activity. Population equations can be wrong by several hundred calories for an individual, so we are starting with a ±10% range. We will refine it after you validate enough food logs and weigh-ins.”

### Loss

> “Your target creates an estimated 15% deficit and aims for about 0.5% body-weight loss per week. We chose a moderate pace to balance progress with training, recovery, and lean-mass retention.”

### Gain

> “Your target starts 7.5% above estimated maintenance. We chose a conservative surplus for your training experience because extra calories do not guarantee faster muscle growth.”

### Recomposition

> “Your target starts at estimated maintenance. Recomposition depends on progressive resistance training and adequate protein, so we will judge progress from weight, measurements, and performance—not scale change alone.”

### No change

> “We are keeping your target the same. Only 12 of the last 21 days were complete, so the available data cannot support a reliable adjustment.”

## Requirements for implementation

1. The app calculates and stores the raw estimate, displayed estimate, formula version, inputs, activity category, uncertainty, and timestamp.
2. Formula versions are immutable; a later equation update creates a new recommendation record.
3. The app never adds wearable exercise calories to an activity-adjusted target.
4. The app explains why it asks for equation sex and keeps the value private.
5. The user can choose a manual calorie or protein target at onboarding.
6. The app records whether each day is complete, incomplete, intentionally untracked, or corrected.
7. The algorithm never interprets missing intake as zero.
8. The first automatic target adjustment cannot occur before day 22.
9. Every adjustment lists included days, excluded days, evidence, confidence, and the exact proposed change.
10. The user can accept, defer, reject, edit, and undo a recommendation.
11. Loss targets respect the percentage cap, calorie cap, and intake floor.
12. Recomposition does not promise simultaneous fat loss and muscle gain.
13. All displayed calorie targets round to 25 kcal while calculations retain full precision.
14. Apple Health writes and sync corrections remain attributed and reversible.

## Validation plan

Before launch:

- unit-test every equation against published examples or independently calculated fixtures;
- compare the NASEM implementation with Mifflin across a grid of ages, heights, weights, sexes, and activity categories;
- flag implausible discontinuities between adjacent activity categories;
- have a registered dietitian and medical safety reviewer approve scope, floors, contraindications, and customer wording;
- test Apple Health coverage rules against missing wear, duplicated samples, and third-party data sources;
- simulate incomplete days and confirm the algorithm never treats them as zero;
- run retrospective validation against de-identified users with at least 28 days of complete food and weight data;
- measure median absolute maintenance error before and after adaptive calibration;
- monitor recommendation acceptance, rejection, reversal, and safety-floor frequency by segment.

Suggested launch gates:

- zero formula fixture failures;
- zero target changes from incomplete data;
- zero targets below the unsupervised floor;
- 100% of recommendations display evidence and confidence;
- median absolute TDEE error improves after two valid calibration windows;
- manual override and undo succeed in end-to-end testing.

## Evidence summary

The evidence is strongest for:

- doubly labelled water as the reference for free-living TDEE;
- indirect calorimetry as the reference for resting expenditure;
- the 2023 National Academies equations as the most directly relevant population estimate for this onboarding data;
- Mifflin–St Jeor as a practical RMR cross-check;
- moderate deficits and gradual loss;
- conservative surpluses and slower gain for advanced trainees;
- protein around 1.6 g/kg/day alongside resistance training for muscle gain;
- higher protein needs for some lean, resistance-trained people during energy restriction.

The evidence is weaker for:

- a universal calorie formula for recomposition;
- consumer wearable calories as individual TDEE;
- exact weekly weight change from a fixed calorie deficit or surplus;
- fixed weekly adjustment sizes;
- any promise that a calorie target will produce a specific change in fat-free mass.

That distinction should remain visible in the product. The algorithm can be precise about its calculation without pretending the biology is equally precise.

## Key sources

1. [National Academies: Dietary Reference Intakes for Energy, 2023](https://www.ncbi.nlm.nih.gov/books/NBK591021/)
2. [National Academies adult EER equations and model error](https://www.ncbi.nlm.nih.gov/books/NBK591021/table/tab_5_5/?report=objectonly)
3. [Mifflin et al.: A new predictive equation for resting energy expenditure](https://doi.org/10.1093/ajcn/51.2.241)
4. [Cunningham: A reanalysis of factors influencing basal metabolic rate](https://pubmed.ncbi.nlm.nih.gov/7435418/)
5. [ten Haaf and Weijs: Cunningham validation in recreational athletes](https://pmc.ncbi.nlm.nih.gov/articles/PMC4183531/)
6. [Lam and Ravussin: Analysis of energy metabolism methodologies](https://pmc.ncbi.nlm.nih.gov/articles/PMC5081410/)
7. [AHA/ACC/TOS adult overweight and obesity guideline](https://pmc.ncbi.nlm.nih.gov/articles/PMC5819889/)
8. [Garthe et al.: Two rates of weight loss in elite athletes](https://pubmed.ncbi.nlm.nih.gov/21558571/)
9. [Iraki et al.: Off-season bodybuilding nutrition recommendations](https://pubmed.ncbi.nlm.nih.gov/31247944/)
10. [Morton et al.: Protein and resistance-training meta-analysis](https://pmc.ncbi.nlm.nih.gov/articles/PMC5867436/)
11. [Longland et al.: High protein during energy deficit and intense training](https://doi.org/10.3945/ajcn.115.119339)
12. [NIDDK: Research behind the Body Weight Planner](https://www.niddk.nih.gov/research-funding/at-niddk/labs-branches/laboratory-biological-modeling/integrative-physiology-section/research/body-weight-planner)
13. [Apple HealthKit active energy documentation](https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifier/activeenergyburned)
14. [Vargas-Molina et al.: Maintenance versus moderate-deficit recomposition protocols](https://doi.org/10.1007/s00421-026-06209-6)
