← All methods

Piecewise + Fourier · Pro

Piecewise trend + Fourier

One midpoint changepoint plus Fourier season — in-engine, no Python Prophet.

What it assumes

One changepoint at the midpoint plus Fourier seasonality (in-engine, no Python Prophet).

When to use

Trend breaks and calendar seasonality.

When to avoid

Very short n or intermittent zeros.

Knobs

OLS piecewise trend + harmonics. Pro.

How it works

This Pro method is a small cousin of Facebook Prophet: a piecewise linear trend with one changepoint at the midpoint, plus Fourier harmonics for season. It is implemented in the TypeScript engine (no Python dependency). Very short series and intermittent zeros are poor fits. Holidays as extra dummies are a later refinement, not a live calendar download.

Sample forecast question

Weekly visits jumped after a mid-sample redesign, then kept rising. What is the piecewise-trend + Fourier forecast for the next four weeks?

Step-by-step on these numbers

Sample series (visits (00s))
PeriodActualFitted
W12019.66
W22121.37
W32120.85
W42222.56
W52221.13
W62323.87
W73635.13
W83737.87
W93837.47
W103939.50
W114039.28
W124141.31
Forecast
PeriodForecast95% interval
W1340.2038.91 – 41.48
W1443.2541.43 – 45.07
W1554.8252.59 – 57.05
W1657.5654.98 – 60.14

Parameters the engine found

  • cp = 6
  • m = 8
  • k = 9
  • b0 = 17.746
  • b1 = 2.148
  • b2 = 0.313
  • b3 = -1.477
  • b4 = 3.990
  • b5 = -1.570
  • b6 = -1.648
  • b7 = 1.368
  • b8 = -0.429
  1. The question

    Weekly visits jumped after a mid-sample redesign, then kept rising. What is the piecewise-trend + Fourier forecast for the next four weeks? Sample weeks: W1=20, W2=21, W3=21, W4=22, W5=22, W6=23, W7=36, W8=37, W9=38, W10=39, W11=40, W12=41 (visits (00s)).

  2. Piecewise trend

    One changepoint at the midpoint index cp = 6 (after W7). Design: [1, t, max(0, t−cp), Fourier sins/cosines with m = 8]. 9 OLS coefficients. No Python Prophet dependency.

  3. Coefficients

    Intercept b0 = 17.746, slope b1 = 2.148, post-break extra slope b2 = 0.313. Fourier terms follow. The jump in the sample is absorbed by the second slope rather than one straight Holt line.

  4. Forecast

    Continue t = 12…15 on the same columns. W13: 40.20; W14: 43.25; W15: 54.82; W16: 57.56.

  5. Interval

    Residual σ = 0.657. For h = 1 the 95% band is [38.91, 41.48] around 40.20. The engine labels this a residual-Gaussian heuristic (σ√h), not a simulation interval.

Graph of this sample

W1 · 20 W12 W13
Piecewise trend + Fourier on the canned sample: actuals, fitted, and a 4-step forecast. Actual Fitted Forecast
The chart plots the canned table on this page (actuals, in-sample fitted, forecast, 95% interval). Not your Excel series. Free analysis never uploads raw data.

Educational only. Not investment, weather, or operational advice. In the add-in, rank is rolling-origin MASE — “best supported among candidates on this series.”

Use it in the Excel Add-in