Interactive figures
Every figure in the track. Each one is a small experiment: drag, slide, and watch the numbers. The link under each figure takes you to the lesson that explains it.
Lesson 1 · Time series and decomposition
Move the lag and watch the right panel. Each blue dot is one pair ; the yellow pair is marked in both panels. For "season + noise" the dots line up at (and ), and they form a falling cloud at , because a seasonal high is followed by a low half a year later. Switch to "trend + season": the trend makes every lag look strongly correlated. The readout is the correlation of the pairs; lesson 02 turns it into the autocorrelation function.
Build a series from its parts, then take it apart. The top panel is the observed series . Below are the true trend, seasonal and remainder parts (solid) and the parts recovered by classical decomposition (dashed). Raise the noise or shorten the series to : the recovered seasonal pattern becomes wrong, because each seasonal index is then an average of only one or two noisy values. Note that the recovered trend has no values at both ends. Switch to "multiplicative": the seasonal swing grows with the level.
Move from 1 to 0. The top panel is the transformed series (blue). The bars show the seasonal swing (maximum minus minimum) inside each year (violet). On the original scale () the last swing is about 9 times the first one. At (log) the bars are almost equal: the multiplicative pattern has become additive.
Change the window and the type. The aqua line is the moving average of the data; the dashed line is the true trend. The yellow band shows the window used at one time, and the lower panel shows its weights. With "centred" and an even , the widget uses the MA (note the half weights at both ends). At the leftover seasonal amplitude is 0. With "trailing" and the season is also removed, but the line is 5.5 steps late.
Lesson 2 · Stationarity and autocorrelation
Compare the two processes. The figure draws 50 paths that all start at 0. For the random walk, the spread of the paths at time grows like : the dashed curves are . Move the time slider and compare the variance across the paths with the formula . Switch to the AR(1) process with : the spread grows at first and then stops at . The AR(1) process forgets old shocks; the random walk does not.
Move and predict the ACF before you look. Left: one sample path. Right: the theoretical ACF (stems) and the sample ACF computed from the path (dots), with the grey band . With negative the ACF alternates in sign. Near the path wanders far from 0 for a long time, and on a short path the sample ACF falls faster than . Press Unit root: now there is no theoretical ACF, but the sample ACF still decays slowly. Press New sample several times: the dots move, the stems do not.
Move the AR order from 1 to 10. Left: the coefficients of the least-squares AR() fit; the last coefficient is the sample PACF value . The dashed boxes are the true coefficients. Right: the PACF builds up one lag at a time. For AR(2) data, the fitted coefficients match the dashed boxes only from on; at the single coefficient is , not . So is close to the true , and from on the last coefficient stays inside the band. Try the AR(1) data: the PACF cuts off after lag 1.
Press the buttons in different orders and watch the ACF. The series is 12 years of a monthly quantity whose seasonal swing grows with its level. Its ACF decays slowly with peaks at lags 12, 24, 36. Try log, then ∇ and ∇₁₂: the ACF falls inside the band and the Ljung–Box test finds no autocorrelation. Now Reset and skip the log: the result is not white noise. Add one more ∇ at the end: jumps to about (over-differencing).
Run the experiments, then switch to differences. Each experiment draws two independent random walks ( in blue, in grey), regresses on and records the t-statistic of the slope. In levels, the histogram is very wide and most experiments land in the magenta region : the test "finds" a relation that does not exist. Try a larger : it gets worse. With differences, the histogram matches the curve and the rejection rate is near 5 %.
Lesson 3 · Baselines and backtesting
Drag in the chart to move the forecast origin (yellow line). The four benchmarks start there: mean, naive, seasonal naive and drift (dashed grey). The blue dots in the shaded window are the values they try to predict; the table scores them. Switch the series: on the seasonal "monthly demand" series the seasonal naive forecast usually wins, on a random walk the naive forecast wins, and on white noise the mean wins.
Each row is one fold. The training window (aqua) ends at the forecast origin (yellow); the test window (violet) holds the next values. Move the sliders and watch the rows. The bottom chart averages the error of the seasonal naive and the drift forecast over all folds, for each horizon : the errors are not the same at every horizon. Then choose "random K-fold": most test points now have training points after them.
Drag the orange forecast across the skewed data. The three curves are , and , each divided by its own minimum. Their minima sit at the mean, the median and a much smaller value. Switch to symmetric data: the mean and the median now agree.
One model, three error estimates. The model predicts from . Its error is estimated by random 5-fold cross-validation, by a rolling origin inside the history, and measured on the true future (the last 50 points). With k-nearest neighbours, random folds are far too optimistic: the neighbours of a test row come from both sides of it in time. In the true future, many values lie above the range of the training data, and k-NN cannot predict outside that range. Switch to linear regression on lags: averaged over 30 series, the three estimates now agree (the deeper box of section 3.5 says why).
Lesson 4 · Exponential smoothing
Move . The bars are the weights of the last 20 observations; the yellow bar is the newest one. Above, the level (aqua) smooths the data (blue), and the forecast (orange) is a flat line from the origin. Small : long memory and a smooth level. : the level is the last value, and SES becomes the naive forecast.
Drag on the curve to move the current . The magenta curve is the SSE of the one-step errors and the orange dot is its minimum. Below, the level follows the data. Before you switch the series, guess where the minimum will be: white noise, random walk, local level.
Pick a model and move its parameters. The training data are the blue line, the test data the blue dots, and the forecast starts at the origin with its 95 % interval (orange band). "Fit" minimises the SSE of the one-step errors on the training part. Notice: SES is flat, Holt's line follows the last swing, damping bends the line, and only the Holt-Winters methods follow the season. Set to freeze the seasonal pattern. On the "growing swings" data compare the additive and the multiplicative method.
Step through time on the monthly CO₂ series (Mauna Loa, 1980–2001). At each month the one-step forecast meets the data; the error moves the level, the trend (middle panel) and the seasonal state (bottom panel), each by its gain times the error. The equations below the figure show the numbers. Parameters: , , , fitted by least squares. Notice how small the trend gain is: the slope of CO₂ is very stable.
Lesson 5 · AR, MA and ARMA
Drag the orange point , or pick an example. Inside the aqua triangle the model is stationary. Below the dashed parabola the roots are complex and the path (blue) oscillates with a period shown in the readout. Notice: the ACF (blue bars) of an AR(2) decays, the PACF (violet bars) is zero after lag 2, and outside the triangle the path explodes. Each path uses the same random shocks.
Drag the orange root of in the complex plane. In "complex pair" mode its conjugate follows; in "two real roots" mode drag both roots along the real axis. The aqua points are the companion eigenvalues . Notice: when a root crosses the unit circle into the inside, its eigenvalue leaves the circle and the path explodes. The closer the roots are to the circle, the slower the ACF decays.
Move the slider and watch the theoretical ACF (blue) and PACF (violet). Notice: the ACF is exactly zero after lag . In MA(1) mode the lower chart draws : it never goes above 0.5. Press θ → 1/θ: the ACF does not change, but only the model with is invertible.
Guess the model. The figure simulates one of AR(1), AR(2), MA(1), MA(2) or ARMA(1,1) and shows the path (blue), the sample ACF (blue bars) and the sample PACF (violet bars) with the grey band . Pick your answer; the feedback explains the pattern. Then make small: with 60 points even the right answer is hard to see.
Choose the order . The blue line is the sunspot series, the orange line the one-step fitted values of an AR() fitted by least squares. Below: the residual ACF (magenta bars) with the grey band, and the AIC for on the same years 1710–2008. Notice: AR(1) leaves a strong wave in the residual ACF; AR(2) removes most of it and gives a period near 11 years; AIC prefers AR(9).
Lesson 6 · ARIMA and SARIMA
Pick a model and move the sliders. Blue: the history (simulated from the chosen model, except for the CO₂ case). Orange line: the point forecast from the yellow origin; dark and light orange bands: 80 % and 95 % intervals. Notice: for AR(1) the forecast returns to the mean and the bands stop growing; for the random walk the bands grow like ; drift tilts the whole fan; ARIMA(0,1,1) gives a flat forecast with growing bands. The readout lists and the 95 % half-width at .
Choose a model and move or . Top: the -weights (orange bars), the effect of a shock steps later. Bottom: the forecast variance (aqua line). Notice: for AR(1) the bars shrink like and the line flattens at ; for ARIMA(0,1,1) all bars after the first equal and the line keeps rising.
Press Step to compute the next forecast of the ARMA(1,1) from the origin with and residual . In each formula, blue terms are known data, magenta terms are residuals (past shocks), orange terms are earlier forecasts and grey terms are future shocks set to 0. Notice: the residual is used only at ; after that the forecast is times the previous forecast.
Choose a transformation of the monthly Mauna Loa CO₂ series (1958–2001, Scripps; data from statsmodels). Top: the transformed series. Below: sample ACF (blue) and PACF (violet) up to lag 36 with the grey band ; dashed yellow lines mark the seasonal lags 12, 24, 36. Notice: the raw series and have a huge, slowly decaying ACF; still decays slowly; only looks stationary, with negative spikes at lags 1 and 12. Those two spikes ask for an MA(1) and a seasonal MA(1): the airline model.
Step through the workflow on the CO₂ series. Each box shows the check made at that step: the plot, the ACF after differencing, an AICc table of candidate models (fitted with statsmodels), the residual ACF and Ljung–Box test of the chosen model, and the 3-year forecast with 80 % and 95 % intervals. Notice: AICc slightly prefers a model with one more parameter, while BIC prefers the airline model; both pass the residual check.
Lesson 7 · State space and Kalman filter
Press Step several times. Each press does one half of the cycle. After predict, the orange point and bar show the one-step prediction and its range: the range is wider than before. After update, the aqua point moves toward the new blue observation and the range shrinks. The yellow line is the current step; the dashed blue line is the true position. Then choose missing at t = 40 to 60 and press Run: the band grows in the grey gap and collapses at . Watch the lower chart: the velocity is never observed, but the filter estimates it. Use the Try buttons to give the filter a wrong or and compare the RMSE readouts. View: whole series shows all 100 steps.
Move the three sliders. The orange curve is the prior (the prediction, mean ), the dashed blue curve is the likelihood of the observation , and the aqua curve is the posterior. Make small: the posterior jumps to and . Make large: the posterior stays at the prior and . Notice that the posterior is always narrower than both other curves.
Switch between the models. Each model is only a different set of matrices , , , , and the same Kalman filter works for all of them. The chart shows one simulated sample: the blue observations, the aqua hidden level, and, for the seasonal model, the violet hidden seasonal part. Press New sample to see another path from the same model.
Move and the start variance . The upper chart shows the gain (aqua): it starts near 1 when is large and settles at (dashed line) after a few steps. The lower chart runs the Kalman filter (aqua) and SES with (orange, dashed) on the same blue data, both started at 0. Notice that the two lines differ only at the start; the readout shows the gap going to 0. With small the start-up takes longer.
Move , then press Go to the maximum. For each , the figure sets to its best value and shows the aqua level with its band over the blue data, and a 10-year orange forecast fan after the yellow origin (1970). The lower chart is the log-likelihood as a function of ; its maximum is at . Notice the drop of the level around 1899 (the first Aswan dam was built from 1898 to 1902). Switch to smoother: the band becomes narrower. Data: Durbin and Koopman (2012), via statsmodels.
Lesson 8 · ML for forecasting
Move the target slider (or click a row) and watch one window become one row of the table: the blue points are the features, the orange point is the target, and the yellow line is the forecast origin. Turn on the rolling mean. With shift(h) it uses only known values (aqua). Set and choose shift(1), then no shift: the window crosses the origin and turns magenta. Each step of or removes one row from the table.
Click cells of the grid (rows: horizon ; columns: lag ). In the direct strategy the cells with are magenta: those values come after the origin. Switch to the recursive strategy: they become orange, because the model uses its own forecasts there. Then choose other variables: a calendar feature is known for every cell; the measured temperature is not, but a weather forecast issued before the origin is.
Switch the target. On the raw level the boosted trees (orange) stay below the largest training value (muted dashed line) while the test data (blue dots) keep rising. Predict the differences instead, or the residual from a linear trend: the forecast now follows the trend. The linear model extrapolates even on the raw level. The data are the track's "monthly demand" series; the origin (yellow) is after month 96.
Compare the two strategies. The data come from an AR(2) process with cycles (, , lesson 05). With the model is wrong: the recursive RMSE rises above the direct RMSE after , as Proposition 3 predicts. Set : both curves meet the best possible RMSE of the true model (muted dashed, from the -weights of lesson 06). The top panel shows one forecast path; move the origin slider to see others.
Move the training length. Twenty series share the same dynamics but have levels from 10 to 1000 (top, blue; switch to the scaled view). Each magenta dot is the MASE of one series (lesson 03); the black bar is the mean. With 12 points per series the local models overfit. The global model on raw values cannot fit all levels with one intercept. The global model on scaled values is the best. With 120 points the local models catch up.
Lesson 9 · Deep learning for forecasting
Switch between the two phases. In training, every orange one-step prediction uses the true blue values as inputs. In prediction, press Draw one path and watch the model read its own last samples (the lags in yellow rings) after the forecast origin. Then draw 100 paths: the band widens with the horizon, because early random draws feed into later steps. Feed back the mean gives one dashed path with no spread. A fixed autoregressive model with a Gaussian head, , plays the role of the trained network.
Change the kernel size, the depth and the dilations. The orange output at time (the yellow line) depends on the aqua hidden values and on the yellow inputs; all other blue inputs cannot change it. Compare "1, 1, 1, …" with "1, 2, 4, 8, …" at the same depth. Then choose centered (the "same" padding of many libraries): magenta edges now reach inputs after time , which is leakage from the future.
Switch between the three kinds of tokens. With patches, change and and watch the number of tokens and the attention cost . The grey dashed part is the padding at the end (PatchTST repeats the last value times). With quantised values, lower the number of bins : the orange quantised values snap to the bin centres and the reconstruction error grows, but it always stays below .
Change the lookback, the forecast origin and the ridge strength. The orange forecast is a weighted sum of the yellow context window; the aqua line is its moving-average trend; the dashed line is the seasonal naive forecast. Below, each bar is the weight of one lag for the chosen horizon : the yellow bars are the lags with the same month as the target. Switch to Linear: with small the forecast barely moves, as the proposition says. Fitted in the browser by ridge regression on the "monthly demand" series.
Step through the models by date, or click a dot. Each dot is one model, placed by how it turns the context into tokens (columns) and what its head predicts (rows); the colour is the backbone (blue encoder–decoder, aqua encoder-only, orange decoder-only, violet recurrent, dark grey tabular in-context model; a ring marks a mixture of experts). The panel gives a one-sentence summary and the source. As of 2026; versions change fast, so check the date of every claim.
Lesson 10 · Probabilistic forecasting
Move , then move . The top panel is the loss of one error : slope on the right and on the left. The lower panel shows 39 blue data values and the orange mean loss over them. Its slope at is the share of data below minus . Notice that the yellow minimum sits where the share below reaches : at the empirical -quantile. Press Move q to the minimum and compare with the order statistic.
Pick a preset, then move the spread and the bias. Each of 300 cases has a known signal and a noisy outcome ; the forecast is . The top panel shows the first 60 outcomes and their 80 % intervals; magenta outcomes fall outside. Too narrow gives a U-shaped PIT histogram and low coverage; too wide gives a hump; biased gives a slope. Notice that the flat PIT at also has (up to sampling noise) the smallest mean CRPS (section 3.4), and that climatology is calibrated but has a much larger CRPS.
Move , and , or pick a preset. The orange curve is the forecast CDF, the blue step is the outcome. The lower panel shows the squared gap; its magenta area is the CRPS. The readouts give the area, the closed form and the kernel form: they agree. Notice: sharp and wrong costs about , and as the CRPS becomes the absolute error of a point forecast. Wide is never far wrong but still pays for its width.
Move and , then switch the noise. The blue series is the "monthly demand" series; the orange line is a least-squares forecast (trend and one yearly sine wave) fitted on (left of the dashed line). The scores come from the aqua calibration window just before the yellow origin; the band is on the 40 test months. Magenta points fall outside. With constant noise the test coverage stays near the guarantee (press New noise to see it vary). With jumps after t = 80, the calibration errors no longer look like the test errors, and the coverage collapses. For small and small , and the band is infinite.
Move , then change the scenario. The top panel shows 400 forecast errors after an initial calibration period of 100. The orange band is ACI on the last 100 scores; the dashed lines are static split conformal from the first 100 scores. At the yellow line the noise triples. The middle panel shows ; the bottom panel shows the coverage over the last 50 steps. Notice: static conformal drops to about 35 % coverage and never recovers; ACI dips briefly and returns to 90 %. With , ACI becomes split conformal on a rolling window and recovers only after the window has refilled.
Lesson 11 · Anomaly detection
Switch the expected value, then move the threshold . The aqua line is the expected value, the blue line the data. Shaded magenta bands are the true anomalies; magenta rings are alarms where the robust z-score of the residual (lower panel) leaves . With the global median, only the spike is found: the contextual and collective anomalies stay inside the normal range of values. The seasonal profile (the median of each hour of the day) finds all three. The seasonal naive forecast also finds them, but notice the false alarms exactly one day later: the anomaly has become the forecast.
Add outliers with the slider. Blue points are 60 normal values; magenta points are outliers (filled when the robust rule flags them, open when it misses them). The orange band is mean ± 3 sd, the aqua band is median ± 3 · 1.4826 · MAD. Notice how the orange band widens with every outlier until it covers them, while the aqua band stays where the normal data are.
Move the shift , the reference and the threshold , then press Run 200 times. The upper panel shows standardised data with a shift at the yellow time and the true mean; magenta rings mark values above 3. The lower panel shows the CUSUM statistic, the threshold, and the alarms (after each alarm restarts at 0). Notice that before the statistic stays near 0, and after it climbs like a ramp, while single values rarely pass 3. A smaller or detects faster but gives more false alarms before ; the simulation shows and the mean delay.
Change the window length . The blue series repeats a cycle of 30 steps; the violet band marks one abnormal cycle whose values all stay inside the normal range. The lower panel is the matrix profile: for each window start, the distance to the nearest other window. Its maximum, the discord, lands on the abnormal cycle. Notice that the profile is near 0 everywhere else, because every normal cycle has a twin. Try half a cycle and two cycles: the discord stays on the anomaly, but the peak changes its shape.
Move the alarm rate of a random detector and draw again. Shaded magenta blocks are the true segments, orange ticks are the random alarms, and aqua blocks are the points that count as detected after point adjustment. Notice that the point-wise F1 stays low (near the share of anomalous points), while the adjusted F1 is high for almost any rate. The long segment is almost always "found".