The series
What arrived
Where the holes are
A gap in a series is not a missing cell in a table. VedaForge would offer you the column mean; here the rows are ordered, and a hole has neighbours in time that know far more about it than the average of everything ever recorded. That is why the filling lives here and not there.
Autocorrelation: the series against its own past
lags
One lag, drawn as a cloud
lag
Is there anything here to model?
Two tests, opposite nulls
ADF asks "is there a unit root?" and hopes to say no. KPSS asks "is this stationary around a trend?" and hopes to say yes. Running only one of them is how a deterministic trend gets differenced by mistake, so both run every time and the four-way verdict below reads them together.
Trend, season, remainder
method
model
Pick a model and look at it
model
horizon
Let it choose the orders (auto-ARIMA)
Stepwise order selection, the Hyndman-Khandakar way: it picks the differencing d and D by tests, starts from a sensible model, and walks the neighbourhood keeping whatever lowers the criterion. It fits a handful of models, not hundreds, and shows every one it tried. It is not a substitute for reading the ACF and PACF above, and whatever it picks still has to survive the backtest.
criterion
Or sweep a grid yourself
The table is shown rather than a winner announced, because AIC and BIC are opinions and neither of them ever saw a forecast.
p≤
d≤
q≤
P≤
D≤
Q≤
Walk forward, because a random split would be cheating
Every fold trains only on data before its origin and is scored on the steps after it, then the origin moves and it happens again. A random train/test split would let a model learn from next week to predict last week. That is not a subtlety, it is the reason a series is not a table.
horizon
folds
window
Fold by fold, so a lucky one cannot hide
What the model left behind
A forecast is only as honest as its residuals. If a pattern survives in them, the model missed it; if the variance clusters in them, the point forecasts may be fine and the intervals are lying.
Fit a model in section 5 first.
Is the variance even worth modelling?
Every model so far forecast the value. GARCH forecasts the UNCERTAINTY: how wide today's shock is likely to be, given how wide yesterday's was. It only makes sense if the variance clusters, so ARCH-LM runs first and the fit is refused if the test says no. GARCH on a calm series fits noise and calls it structure.
ARCH and GARCH, written out
The recursion is one line, and worth seeing rather than importing: sigma-squared today is a baseline, plus a slice of yesterday's shock, plus a slice of yesterday's variance. statsmodels has no GARCH and the arch package cannot run in a browser, so this one is hand-written, and the test suite checks it against arch to four decimals.
GARCH order p
ARCH order q
The payoff: a band that breathes
A 95% interval should leave about one day in twenty outside it. A constant-variance band leaves too many out in the storms and too few in the calm, all at one width. The GARCH band widens over the turbulent stretches and tightens over the quiet ones, so its misses scatter the way a calibrated interval's should.
A network cannot read a series. It reads rows.
Every model so far took the series whole. A neural network needs it reshaped: the last L values become the inputs, the next value becomes the target, and the window slides down the series making one row after another. This is the single idea the whole neural half rests on, so look at it before training anything.
lookback L
Train it, here, on your data
SimpleRNN, LSTM or GRU, built and trained in this browser with TensorFlow.js (about 1 MB, fetched once when you first train). Nothing pretrained is downloaded: this network starts from noise and learns YOUR series, on WebGL if your machine has it. Watch the loss fall. Then it is judged by the same walk-forward backtest as every classical model, because a network that picks its own scoreboard has already won.
architecture
units
layers
dropout
epochs
batch
learning rate
horizon
folds
An unusual point is one the model did not see coming
Anomaly detection here is not a separate discipline: it is the residuals, read with a threshold. A point that the trend and season could not explain, or that a fitted model did not predict, is flagged. The score is a robust z (median and MAD, not mean and sd) so the outliers you are hunting cannot inflate the yardstick and hide each other. A flag is a question, not a verdict.
view
model
threshold z
Structural breaks: the day the rules changed
A break is not an anomaly. An anomaly is one strange day; a break is where the level of the series stepped to a new value and stayed there. Found by detrending, then asking where a single split most reduces the squared error. A model fit across a break is fitting two different series at once.
up to breaks
The prepared series and its parts
Your series exactly as you prepared it, with its trend, seasonal and remainder alongside, as a CSV you can take anywhere.
A forecast with its interval
model
horizon
The point forecast and a 95% interval that grows with the square root of the horizon, because one-step errors compound as you predict further out.
The backtest, the whole table
horizon
folds
The code that reproduces this
Your loading, your filling, your transform, your differencing, written as the pandas and statsmodels that do the same thing.