How the algorithm works

HonestSlim uses a Monte Carlo simulation to model weight loss as a random process — not a deterministic equation. Here's exactly what runs under the hood.

The core idea: Monte Carlo simulation

A standard weight loss calculator takes your deficit and divides it by 7,700 kcal/kg. That gives one number: a straight line. It's wrong every time because real weight loss has genuine randomness — your adherence varies week to week, your metabolism adjusts, water retention creates phantom gains and drops.

HonestSlim runs your scenario 5,000 times independently. Each run gets slightly different adherence, slightly different water fluctuation, and slightly different metabolic response. The 5,000 outcomes are then sorted into percentile bands — the fan chart.

The fan chart is not guesswork. It's the actual distribution of outcomes from your specific inputs.

Step 1 — Basal Metabolic Rate (Mifflin-St Jeor)

Every simulation starts by calculating how many calories your body burns at rest. HonestSlim uses the Mifflin-St Jeor equation, the most validated BMR formula for general populations:

Base = (10 × weight_kg) + (6.25 × height_cm) − (5 × age_years)
Male:   BMR = Base + 5
Female: BMR = Base − 161

Source: Mifflin MD, St Jeor ST, et al. (1990). "A new predictive equation for resting energy expenditure in healthy individuals." American Journal of Clinical Nutrition.

Crucially, BMR is recalculated every week as weight decreases. This is why the fan bands visibly curve and flatten in the second half of a simulation — your body burns fewer calories as it gets lighter. A straight-line calculator ignores this entirely.

Step 2 — Adherence modelling

You set a target adherence percentage — how consistently you plan to follow your deficit. But week-to-week adherence isn't constant. Some weeks you're perfect; some weeks a birthday dinner or a stressful period knocks you off track.

Each week, HonestSlim samples actual adherence from a normal distribution centred on your target:

actualAdherence = Normal(targetAdherence, σ=8%)
// Clamped to [5%, 100%] — can't be negative or over 100%

This means that at 80% target adherence, most weeks land between 70–90%, with occasional weeks near 60% or near 100%. Drag the adherence slider down and watch the fan widen dramatically — this is the most honest input in any weight loss tool.

Step 3 — Weekly simulation step

For each week in each of the 5,000 simulations, six calculations run in sequence:

  1. 1 Sample actual adherence — how on-plan were you this week? Drawn from Normal(target, 8%)
  2. 2 Weekly deficitdailyDeficit × 7 × actualAdherence — total calories actually cut this week
  3. 3 Raw fat lossweeklyDeficit / 7700 — converting calories to kg (7,700 kcal ≈ 1 kg of body fat)
  4. 4 Metabolic adaptation factor — scales the loss down as your BMR decreases relative to your starting BMR (explained below)
  5. 5 Weight noiseNormal(0, 0.45 kg) — simulates water retention, food in transit, measurement variation
  6. 6 Weight updatemax(goalWeight, weight − rawLoss × adaptationFactor + noise) — weight never drops below goal

Step 4 — Metabolic adaptation

As you lose weight, your BMR drops. Your body requires fewer calories at a lower weight, so the same deficit produces less fat loss over time. This is not a failure — it's normal physiology.

HonestSlim models this with an adaptation factor calculated each week:

currentBMR     = mifflinBMR(currentWeight, height, age, sex)
adaptationFactor = 0.75 + 0.25 × (currentBMR / startBMR)

What this produces:

BMR remaining Adaptation factor Effect
100% (no weight lost yet) 1.00 Full loss rate
90% of start BMR 0.975 2.5% slower
80% of start BMR 0.95 5% slower

The effect is subtle but compounds over time. It's why the fan bands visibly curve rather than descend in a straight line.

Step 5 — Building the fan chart

After all 5,000 simulations complete, the results are aggregated week by week. For each week, all 5,000 weight values are sorted and five percentile points are extracted:

p10  — 10% of people are at this weight or lower (best outcomes)
p25  — 25% of people are here or lower (above average)
p50  — median — half are above, half are below
p75  — 75% are here or lower (slower outcomes)
p90  — 90% are here or lower (slowest realistic outcomes)

The simulation loop continues until the 90th percentile reaches goal weight — not the median. Stopping at p90 lets every band arrive naturally.

Why five lines and not one? The spread between p10 and p90 is the honest answer to "when will I reach my goal?" It might be 16 weeks, or it might be 35 weeks. Both are real outcomes from real inputs. The single-line calculators pick a number in the middle and pretend uncertainty doesn't exist.

Step 6 — The 30 individual paths

Percentile bands summarise 5,000 journeys but hide the texture: the multi-week plateaus, the sudden drops, the upward blips that make dieters panic. HonestSlim picks 30 of the 5,000 simulations at random and draws them as individual grey lines beneath the percentile bands.

One path — the simulation whose final weight is closest to the median — is highlighted as a dashed line. This is "a typical journey": not the best case, not the worst, but a realistic individual experience.

Normal distribution sampling — Box-Muller

JavaScript's Math.random() produces a uniform distribution — not a bell curve. HonestSlim uses the Box-Muller transform to sample from a normal distribution in pure JavaScript:

function sampleNormal(mean, sd) {
  let u = 0, v = 0;
  while (u === 0) u = Math.random();
  while (v === 0) v = Math.random();
  const z = Math.sqrt(-2 * Math.log(u)) * Math.cos(2 * Math.PI * v);
  return mean + sd * z;
}

This runs twice per week per simulation — once for adherence noise, once for weight noise.

Performance

5,000 simulations × up to 104 weeks = up to 520,000 iterations, each doing two normal samples, one BMR calculation, and a handful of arithmetic operations. Typical runtime is 30–60ms on a modern browser. Everything runs client-side — no server, no API call, no data leaves your device.

Known limitations

Limitation Why it exists
No activity level multiplier TDEE multiplier not modelled — users should factor activity into their deficit estimate
Linear adaptation model Real metabolic adaptation is more complex; this is a validated approximation
No muscle mass model Resistance training affects body composition but not weight loss rate directly in this model
Symmetric noise Real weight fluctuations are slightly right-skewed; symmetric normal is a simplification
Try the simulator →