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
| Period | Actual | Fitted |
|---|---|---|
| W1 | 20 | 19.66 |
| W2 | 21 | 21.37 |
| W3 | 21 | 20.85 |
| W4 | 22 | 22.56 |
| W5 | 22 | 21.13 |
| W6 | 23 | 23.87 |
| W7 | 36 | 35.13 |
| W8 | 37 | 37.87 |
| W9 | 38 | 37.47 |
| W10 | 39 | 39.50 |
| W11 | 40 | 39.28 |
| W12 | 41 | 41.31 |
| Period | Forecast | 95% interval |
|---|---|---|
| W13 | 40.20 | 38.91 – 41.48 |
| W14 | 43.25 | 41.43 – 45.07 |
| W15 | 54.82 | 52.59 – 57.05 |
| W16 | 57.56 | 54.98 – 60.14 |
Parameters the engine found
cp= 6m= 8k= 9b0= 17.746b1= 2.148b2= 0.313b3= -1.477b4= 3.990b5= -1.570b6= -1.648b7= 1.368b8= -0.429
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)).
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.
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.
Forecast
Continue t = 12…15 on the same columns. W13: 40.20; W14: 43.25; W15: 54.82; W16: 57.56.
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
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.”