peptrendGet the app

Why your trend line changes last week (LOESS and Savitzky-Golay)

Because those two methods average weigh-ins from after each day as well as before. In Peptrend, LOESS is a tricube-weighted mean over up to 31 days either side and Savitzky-Golay a centred average over 7 days. On one user's log, a day's LOESS value moved by 0.62 lb on average once the following month arrived; Savitzky-Golay moved 0.22 lb within three days. Other methods never revise a past day.

Most trend lines are fixed once drawn. Weigh in tomorrow and today’s point stays where it was; only the new day is added. Two of Peptrend’s fifteen methods work differently, and someone who picks either will see last week’s line bend after a new reading. That is the design of those methods, not a bug, and it decides what they are good for.

Why does the line change for days already past?

Because LOESS and Savitzky-Golay compute each day’s value from readings on both sides of it. A centred average for Tuesday needs Wednesday’s and Thursday’s readings. Until they exist, the method uses what it has; when they arrive, Tuesday is recomputed. Statisticians call such a filter non-causal: its output for a moment depends on later inputs.

Every other method in the app is causal. The exponential methods, the moving averages, the Kalman filter, Rolling Median and Weekly Average compute each day from that day and the ones before it. A new weigh-in adds a point to those lines and leaves every earlier point alone. Checked on one user’s log, the default Robust Adaptive EWMA gives exactly the same value for a past day whether the log stops there or runs on for months.

What do the app’s LOESS and Savitzky-Golay compute?

Simpler things than their names suggest.

  • LOESS in Peptrend is a tricube-weighted moving mean. For each day it averages the daily series across a span on either side, with weights that fall smoothly to zero at the edge. The span is a third of the series length, held between 7 and 31 days, so any history longer than about three months uses 31 days either side.
  • Savitzky-Golay in Peptrend is a centred moving average over a 7-day window at the default settings: three days either side, equally weighted.

Neither runs the technique it is named after. Cleveland’s LOESS fits a weighted regression line at every point, and the Savitzky–Golay filter fits a low-order polynomial across each window. Peptrend’s versions skip the fitting and keep the averaging. The method cards inside the app still describe the textbook techniques, a local regression and a polynomial fit, so read those cards as describing the family rather than the code. Both run on the daily series, so missed days are filled by a straight line between the readings either side before the averaging starts.

How much does a past day move?

On one user’s log, 84 weigh-ins over 225 days, the comparison is direct: compute each day’s value using only the readings up to that day, then again with the full log, and measure the difference.

MethodWindowAverage revision90th percentileLargestSettled after
LOESSup to 31 days either side0.62 lb1.22 lb1.34 lb31 days
Savitzky-Golay3 days either side0.22 lb0.59 lb0.75 lb3 days
Robust Adaptive EWMApast only000never revised

LOESS keeps revising for a month. A week after a given day, its value was still 0.37 lb on average from where it would end up, and the largest remaining gap was 0.90 lb; two weeks after, 0.17 lb on average. Savitzky-Golay is done in three days.

Those figures cover days in the middle of the log, where a full window exists on both sides once the log runs on. The newest days are the ones that move most, because they are computed from one side only.

What are these methods good for?

Looking back. Once a stretch of log is a month old, its LOESS values have stopped moving, and LOESS draws the calmest line in the app: on this log it moved 0.074 lb a day and ignored 82.8% of the scale’s day-to-day movement, finishing at 184.7 lb. Savitzky-Golay is twitchier, at 0.163 lb a day and 62.0% ignored, but it settles within three days. For seeing the shape of a finished stretch — where a plateau began, how long a step lasted — a symmetric average is a reasonable tool, because it has no lag in either direction.

They are poor for today. The right-hand end of the line is the part that will change, and the weekly rate the app shows is a seven-day look-back on that end. A rate read off a LOESS line this week is a rate that next month’s readings will rewrite. The app’s method cards flag both as using future data for this reason.

Which method should you use for the latest reading?

A causal one. The default Robust Adaptive EWMA only reads the past and adapts its smoothing to how steadily the weight is moving. Choosing a trend method compares all fifteen, and why your trend line lags covers the cost a causal line pays for never looking ahead: it trails turns by days.

That trade is the whole choice. A centred average is unbiased in time and unstable at the edge; a trailing one is stable at the edge and late at every turn. The signal-to-noise post shows why neither can beat the noise on a short log. LOESS, Savitzky-Golay and the rest of the Advanced Mode methods are Pro; the methods page has each formula as the app runs it.

Peptrend's Trend Info screen, showing the Current Method card for Robust Adaptive EWMA with its formula, behaviour, pros, cons and best use case listed underneath.
Each method's info card lists its formula and its drawbacks, including whether it reads future points.

Common questions

Why did my weight trend change for days in the past?

If the method is LOESS or Savitzky-Golay, each day's value averages readings from after that day too, so every new weigh-in redraws the recent part of the line. The other thirteen methods only look backward and never change a past value.

Is Peptrend's LOESS a local regression?

No. The app's LOESS is a tricube-weighted moving mean, and its Savitzky-Golay is a centred moving average. Both borrow their names from techniques that fit a line or polynomial locally; the app's versions are simpler weighted averages.

Which trend method should I use for today's weight?

One that only reads the past, such as the default Robust Adaptive EWMA. LOESS and Savitzky-Golay are better for looking back at a finished stretch, because their latest values will change as readings arrive.

Sources