Time Series
Real series carry trend, seasonality, and changing variance; the first job is always to strip those until the residual is stationary, because stationarity — constant mean, and a covariance depending only on lag — is the only regime where averaging over time substitutes for the repeated samples we never get. Once stationary, every model is one object, the backshift polynomial , and the roots of those polynomials decide causality, invertibility, the autocorrelation shape, and the spectrum. Running underneath is a second thread, the time ↔ frequency duality: the autocovariance and the spectral density hold the same information in two bases, and you transform to whichever makes the next step easy. Prerequisites cashed in: stationarity and Markov structure (track 5 §1, §6), MLE/CLT/χ² tests and the delta method (track 3), Toeplitz systems and projection (track 2), EM and the forward recursion (track 7 §6, §8).
1. The frame and stationarity
Picture to hold. A time series is one realization of a stochastic process indexed by time. You see a single path, not repeated samples — so you cannot estimate “the distribution at time ” by averaging many draws. The only thing that rescues estimation is an assumption that the process looks the same after a time shift: then averaging over time substitutes for averaging over realizations. That assumption is stationarity, and it is the hinge of the whole subject.
The working decomposition for a raw series:
- = trend (slow secular movement),
- = seasonality (periodic, known period , ),
- = the stationary residual we actually model.
White noise is the baseline residual: mean zero, finite variance, uncorrelated across time.
- White noise (WN): , , for .
- iid noise: WN and independent (stronger — kills nonlinear dependence too).
- Gaussian WN: iid noise with .
White noise has no exploitable structure — you cannot predict it from its past. So the entire modeling pipeline is: transform → fit → check the residuals are white noise. If they are, you have extracted all the linear signal; if they aren’t, there is structure left to model.
Strict vs weak stationarity
Strictly stationary: the joint distribution of equals that of the shifted block for every and every collection. The entire probabilistic law is shift-invariant.
That is far more than we can check or need. We weaken it to the first two moments:
Weakly (second-order) stationary: finite variance, and
- (i) constant (no trend),
- (ii) depends on the lag only, not on .
“Stationary” unqualified means weakly stationary — it is the realistic assumption. Two immediate consequences:
- The autocovariance collapses to a one-argument function , and it is symmetric: (since ).
- The autocorrelation is , with .
Strict ⟹ weak always (matching whole laws forces matching moments), but not conversely.
Counterexample (weak ⇏ strict). Build a series that is Gaussian WN on even and centered-and-rescaled WN on odd , with the two arranged to share mean and variance . Every covariance is and the mean is constant, so it is weakly stationary — yet the marginal distribution differs between even and odd , so it is not strictly stationary. Matching moments is not matching laws.
Special case (Gaussian). For a Gaussian process (every finite block is multivariate normal) the law is determined by mean and covariance, so weak ⟺ strict. This is why Gaussian assumptions are so convenient here.
Not stationary: a random walk (covariance grows with ), anything with a trend (mean depends on ), ARCH-type changing variance.
Diagnostic picture. Take two windows from the series and overlay their histograms. Stationary → the histograms overlap. Non-stationary (trend or changing variance) → they separate or spread.
Measuring dependence: ACF and the correlogram
Autocorrelation function — the correlation of the series with itself steps back. We estimate it with the sample ACF:
White-noise test. Under WN, for fixed lag and large (a CLT result — cross-link [[03_Statistical_Inference]]):
So a single outside is significant evidence against white noise at 5%. Plot the with bands at — that plot is the correlogram.
Numeric anchor. bands at . Lag 0 is always .
Multiple-testing trap. With lags plotted, the expected number exceeding the bands under pure white noise is For lags you expect exceedances even if the data is genuinely white noise. Never read a single border-crossing as proof of structure; this is exactly why §5 needs a joint (portmanteau) test, not eyeballing.
Implications of §1.
- Stationarity is what makes “average over time = average over the ensemble” legitimate; without it, estimation has no ground to stand on.
- The modeling loop is transform until residuals pass the white-noise test. Everything downstream is machinery for that loop.
- being a function of lag alone is what later lets prediction reduce to a Toeplitz linear system (§5) — cross-link [[02_Linear_Algebra]].
Core competency set §1.
- State weak stationarity (two conditions) and why .
- Reproduce the WN band and the expected-exceedances calculation.
- Give the weak-but-not-strict counterexample and the Gaussian weak⟺strict fact.
2. Getting to stationary: trend, season, variance
The residual is what we model, so first remove , , and any mean-dependent variance.
Trend estimation
Three routes, increasing in assumption-freedom:
- Parametric: posit a form, e.g. quadratic by least squares. Accurate if the form is right; gives clean forecasts; risks misspecification.
- Smoothing/filtering: local average . Window is a bias–variance dial — small low bias/high variance, large the reverse. No forecasts at the endpoints, no clean extrapolation.
- Isotonic (monotone trend): minimize s.t. — a convex program. Rarely used; can’t forecast; degenerate on already-monotone data (returns the data, residual , learns nothing).
Caution (ML models extrapolate flat). A random forest fit to a trended series predicts a constant outside the training range — it averages the last values and cannot continue a trend. It sees no time structure. This is the recurring weakness of memory-based methods here.
Differencing — remove the trend without estimating it
Define the difference operator .
Linear trend, worked. . Then Constant mean , no trend. One difference kills a linear trend.
Quadratic trend, worked. (noiseless). — still trending. Difference again: A degree- polynomial trend needs differences.
Counterexample / caution (over-differencing). Differencing white noise introduces autocorrelation: if then has . So you can manufacture spurious structure by differencing too many times. Difference, check the ACF, stop at the lowest order that looks white.
Forecasting back through differencing. If has mean , invert: . For : since , forecast .
Stochastic trend. A random-walk-with-drift trend is not deterministic, but differencing still removes it — another reason to prefer differencing when you don’t want to commit to a trend form.
Seasonality
Model with periodic of known period (monthly→, weekly→). Two approaches:
- Harmonic regression: . Start at low frequency (the big oscillations), add higher for finer structure — a bias–variance dial again. Linear in , so ordinary least squares fits it.
- Seasonal differencing: . With and ,
mean zero. You lose a full period of observations. For trend and season, seasonal-difference first, then ordinary-difference the result.
Variance-stabilizing transforms (delta method)
Heteroscedastic data — e.g. variance growing with the level — breaks stationarity through condition (i)/(ii) on the transformed scale. Suppose for known . Find so that has roughly constant variance.
Derivation (delta method — cross-link [[03_Statistical_Inference]]). Taylor-expand about :
Here is deterministic; only the last term is random. So
Choose to make the right side constant.
Numeric anchors.
- (count-like). Try : , constant. → square-root transform, standard for counts.
- (multiplicative / compounding). Try : , constant. → log transform, standard for stock-like data.
Transforms are not unique ( works as well as ); pick the simplest.
Implications of §2.
- Pipeline order: variance-stabilize → de-trend (difference or regress) → de-season → check residual ACF.
- Differencing trades estimation for robustness — you remove trend without committing to its shape — but over-differencing injects negative autocorrelation, so it has its own cost.
- The square-root/log dichotomy (variance ∝ mean vs ∝ mean²) is worth memorizing; it recurs in GLMs (Poisson vs lognormal).
Core competency set §2.
- Difference a linear and a quadratic trend by hand; invert a one-step and two-step difference for forecasting.
- Derive the variance-stabilizing condition and produce / for the two canonical ‘s.
- Explain why over-differencing is harmful and how seasonal differencing works.
3. MA and AR models — the backshift polynomial
Now the residual is stationary. The two atoms are moving-average (build the present from past noise) and autoregressive (build the present from past values). The unifying device is the backshift operator : , .
Moving average MA(q)
A finite linear combination of white-noise shocks (not a true average — just a linear model in the ‘s).
MA(1) is weakly stationary — worked. , .
No appears → weakly stationary. Every MA(q) is weakly stationary (finitely many shocks, constant-in- covariances). The general autocovariance:
Signature in the ACF. MA(q) autocorrelations are nonzero up to lag then cut off sharply to zero. (Contrast AR, which decays exponentially without a hard cutoff — §3 AR.) Seeing a clean cutoff at lag is the fingerprint of MA(q).
Invertibility — pinning down the parameters
Two different MA models can generate the same process, so the parameters aren’t identified without a restriction.
The two-representations problem, worked (Gaussian). With , has , . Now set (so ) and consider : Identical mean, variance, and covariances. For Gaussian noise that means identical law — two MA(1) models ( and ) for one process.
The fix: require the shock at time to dominate, , equivalently the polynomial has its root outside the unit circle:
Definition. MA(q) is invertible if for all (all roots strictly outside the unit circle).
Theorem (why invertibility matters). A model is invertible iff the noise can be recovered as a convergent linear combination of the observations:
i.e. there is a stable form . This is exactly the form prediction needs.
Why we insist on it — worked. Non-invertible . Solving for the AR form by repeated substitution gives weights — they explode, so the infinite past has unbounded influence: useless for prediction. The invertible twin gives decaying weights . Same process, but only the invertible representation is usable.
Numeric anchors (root test).
- : , root → invertible.
- : , roots → root on the boundary ⇒ not invertible.
Autoregressive AR(p)
Note the sign convention: the ‘s move to the same side as before forming the polynomial (opposite of MA, where acts on the ‘s).
The geometric-series inversion. Treat as a number and divide:
For AR(1), , so if use :
the representation. (Rigorously: is a norm-1 shift operator, so the Neumann series converges iff — same unit-root condition as MA, in disguise.)
Lemma — the guess solves the recursion. With ,
Uniqueness — the remainder vanishes. Suppose also solves . Iterating:
The remainder’s size (stationary, so constant):
So : the unique stationary solution. (Non-stationary solutions exist — add for any — but only one is stationary.)
AR(1) autocovariance via the MA(∞) form. Using with :
Signature in the ACF. AR(1) autocorrelations decay exponentially — no hard cutoff. : smooth positive decay. : decaying oscillation (alternating sign), a good visual cue that an AR term is needed.
Causality — depend only on the past
Mirror of invertibility, but for AR: we want expressible as a stable combination of past noise (an ), not future noise.
Definition. AR(p) is causal if for all (roots outside the unit circle) — equivalently it has an form .
Non-causal, worked. , , root → not causal. Forward substitution gives weights (explode). Reversing time, , yields a convergent expansion — but in terms of future noise . There is a stationary solution, but it depends on the future: useless.
Numeric anchors (root test).
- : , root → causal.
- Random walk : , root on the boundary → not causal (and not stationary). Fix by differencing: . When a root sits near 1, difference.
- : , roots on the unit circle → not causal.
The duality, stated cleanly:
| process | the polynomial restriction | what it buys |
|---|---|---|
| MA(q) | invertible: , $ | z |
| AR(p) | causal: , $ | z |
MA↔AR are two views of one model. is an (shown above); conversely an with collapses to by the same geometric-series trick run backwards. The notation you choose is whichever makes the next step easy: MA for the ACF, AR for prediction.
Implications of §3.
- Roots outside the unit circle is one condition wearing two names (causality for AR, invertibility for MA); both ensure the relevant infinite expansion converges.
- The ACF/PACF shapes (cutoff vs decay) are how you read the order off a plot — the practical payoff of all this algebra (§4 PACF).
- The geometric-series inversion is the workhorse you reuse for ARMA (§4) and for the spectral density (§7).
Core competency set §3.
- Show MA(1) is stationary and compute its ; state the MA(q) cutoff.
- Invert AR(1) to via geometric series; prove existence (it solves the recursion) and uniqueness (remainder ).
- Derive and .
- Test causality/invertibility by the unit-root rule on three worked polynomials.
4. ARMA — combining, computing, and Yule–Walker
ARMA(p,q): . AR and MA together; the earlier models are special cases ARMA(0,0)=WN, ARMA(p,0)=AR, ARMA(0,q)=MA. Always assume and share no common roots (else you’re describing a simple process with needless parameters).
Common-factor counterexample. has . It looks like ARMA(1,1), but substituting shows — plain white noise, ARMA(0,0). Cancel common factors first. (Another: , share ⇒ reduce ARMA(2,2) to ARMA(1,1).)
Conditions. ARMA is causal iff on (⇒ ), invertible iff on (⇒ ).
Getting the MA(∞) form — polynomial division by geometric series. Want .
Worked, ARMA(1,1). , so , . giving . (R:
ARMAtoMA.)
Why bother with each representation? The MA(∞) gives the ACF; the AR(∞) gives predictions.
ACF of ARMA — the difference-equation route
Computing from the needs the whole infinite even for one lag — wasteful. Instead, take covariances of both sides of the ARMA equation against .
Derivation. From , take . LHS:
RHS (using that correlates with only through the weights ):
Equating gives a finite recursion for .
Yule–Walker (the AR(p) special case)
For pure AR(p) the RHS is at and for . Writing the recursion for and using :
i.e. . Then recover from : .
is symmetric Toeplitz (constant along diagonals — cross-link [[02_Linear_Algebra]]) and full rank, hence invertible: the system always solves, and the Toeplitz structure makes it fast (Levinson–Durbin).
Worked AR(2) numeric. Sample autocorrelations , . Dividing the YW system by gives it in correlation form: Determinant . By Cramer’s rule: Then — the AR(2) explains 40% of the variance. (Check causality: has complex roots of modulus ✓.)
When does Yule–Walker fail? When degenerates — all covariances equal (a noiseless, perfectly correlated series). Near-zero noise ⇒ near-singular ⇒ unstable estimates. Opposite of ordinary stats, where low noise helps.
PACF — reading AR order off a plot
Partial autocorrelation = the coefficient of in the best linear predictor of from — the correlation of with after removing the intervening lags’ influence.
Why AR(p) PACF cuts off at — derivation. Regress on the previous lags; is the last coefficient .
- For : the AR(p) equation already is the best linear predictor from lags, with past. So the order- regression returns the true coefficients exactly, and .
- For : write the best predictor from lags. Because with uncorrelated with all of (causality ⇒ independent of the past), the optimal weights put on the first lags and exactly zero on lags — adding older lags cannot reduce error once the -lag predictor already achieves the irreducible . Hence for . ∎
The mirror statement for MA(q) (ACF cuts off at ) is immediate from for (§3). The two cutoffs are duals:
| MA(q) | AR(p) | |
|---|---|---|
| ACF | for (sharp cutoff) | decays to as |
| PACF | decays to as | for (sharp cutoff) |
They are mirror images: ACF cuts off for MA; PACF cuts off for AR. A mixed ARMA shows neither clean cutoff — which is why you fit low-order AR or MA first and only escalate to ARMA if needed.
Numeric/diagnostic anchor. ACF cuts off after lag 2 → consider MA(2); but a single sharp PACF spike at lag 1 → an AR(1) may be the simpler truth. Start simple, check residuals.
Implications of §4.
- Common-factor cancellation enforces parsimony — the simplest equivalent model is the one you want.
- Yule–Walker turns AR estimation into a Toeplitz solve, fast and always solvable (away from the noiseless degeneracy).
- ACF/PACF cutoffs are the bridge from the algebra of §3 to actual model-order choice.
Core competency set §4.
- Divide by geometric series to get .
- Derive Yule–Walker by covariancing both sides; write and note Toeplitz/invertible; solve a 2×2 AR(2) system by hand.
- Derive why AR(p) PACF cuts off at (causality ⇒ older lags get zero weight); state the full ACF/PACF cutoff table and use it to pick orders.
- Give the common-factor counterexample.
5. Fitting, prediction, and selection
Best linear prediction (the projection view)
With only weak stationarity we trust linear predictors (higher moments may drift; cross-link [[02_Linear_Algebra]] projection). Predict from predictors by ; the optimal weights are
exactly with covariances in place of cross-products. For forecasting, the predictors are past values and is the future value, so appears on both sides.
Under stationarity, (Toeplitz) and — so prediction reduces to a Toeplitz solve.
One-step, worked. Predict from : , , so — the lag-1 autocorrelation times the last value.
For a causal AR(p) with , the best linear predictor is the model equation: . Gaussian noise ⇒ prediction interval .
ARMA prediction: switch to the form , truncate, and forecast . Multi-step: iterate (predict one step, feed it back) — optimal by iterated expectations.
Long-horizon punchline. As the horizon grows, the prediction converges to the overall mean and the interval widens to the stationary SD (you’re taking powers of a matrix with eigenvalues in modulus). If log-returns follow an invertible ARMA, the long-run forecast of log-returns is just their mean — no free lunch.
Parameter estimation — three methods
- Yule–Walker / method of moments (AR only): match sample ACVF at lags , solve (§4). Linear, fast, but AR-only and not efficient for ARMA.
- Conditional least squares (general ARMA): rewrite the noise recursively, e.g. MA(1) ; set , recurse , minimize . “Conditional” because it conditions on the made-up initial — harmless asymptotically since the past’s influence decays exponentially. (ARMA(1,1) needs -history too, so start at .) Nonlinear for ARMA.
- Maximum likelihood (Gaussian): maximize the exact likelihood from the autocovariance matrix. Same idea as conditional LS but handles the start-up exactly. Standard practice: warm-start MLE from conditional-LS estimates (R
arimamethod="CSS-ML"). The three usually agree closely.
Model selection
- AIC (for ARIMA , the for the estimated mean and ). Estimates out-of-sample error, asymptotically like CV → use for prediction. Tends to pick a slightly-too-large model.
- BIC . Heavier penalty ⇒ smaller models; model-selection consistent (recovers the true order as ) → use to identify the true process. Small risk of choosing too-small a model, which can hurt prediction.
- Time-series CV. Fit on , forecast , record ; sweep ; average the squared errors. Train on the past, validate on the future only — ordinary CV would illegally train on the future to predict the past. Seasonal data: leave out whole periods; -step goal: forecast .
Testing white noise — the portmanteau test
Eyeballing the correlogram fails the multiple-testing problem (§1). Use a joint statistic.
For white noise, , so
After fitting an ARMA with estimated parameters, the degrees of freedom drop and we use the Ljung–Box–Pierce statistic
Reject “residuals are white / model adequate” if exceeds the quantile (one-sided). Subtract because parameters were estimated from the data (cross-link [[03_Statistical_Inference]] — same df-deduction as in goodness-of-fit). Choose max lag carefully: too small misses far seasonal spikes; too large breaks the approximation. Pair the test with the residual ACF and standardized-residual plots — the test can miss what the eye catches and vice versa.
Implications of §5.
- Prediction is a Toeplitz projection; AR makes it trivial because the model is the predictor.
- AIC-for-prediction vs BIC-for-truth is the one-line rule to memorize.
- “Validate only on the future” is the non-negotiable difference from ordinary CV.
Core competency set §5.
- Write the best-linear-predictor formula and specialize to one-step () and causal AR.
- Contrast Yule–Walker / conditional-LS / MLE and say when each applies.
- State AIC vs BIC roles and the time-series CV protocol.
- Write the and Ljung–Box statistics with the right df and explain the .
6. Extensions: ARIMA and seasonal models
Bundle differencing and seasonality into the ARMA machinery.
- ARIMA(p,d,q): difference times, then fit ARMA: (plus mean). Removes polynomial trends / random walks inside the model. (R
arima, middle index .) - Seasonal ARMA (period ): — AR/MA terms only at the seasonal lags . Why not plain ARMA(2s,2s)? That would carry AR + MA parameters (e.g. for ) — unstable. S-ARMA fits 4.
- Multiplicative seasonal ARMA: — captures short-range and seasonal dependence together with few parameters. Use when the ACF/PACF show spikes at the seasonal lags and in the small lags around them; the width of the surrounding spikes signals the order of the short-range terms.
- SARIMA: the full object — multiplicative seasonal ARMA with both ordinary () and seasonal () differencing:
Fit step by step (plot → de-trend → ACF/PACF → low-order AR/MA → escalate); R sarima (package astsa) gives the diagnostics.
Core competency set §6. Read ARIMA; explain why multiplicative S-ARMA beats a giant plain ARMA on parameter count/stability; write the SARIMA operator.
7. Frequency domain
Picture to hold. A stationary process is a superposition of random periodic components at different frequencies. The time domain (ACF) and frequency domain (spectrum) hold the same information in two bases; you Fourier-transform to whichever is easier — exactly the MA↔AR spirit, now for the whole series.
Why transform: optimizing over a phase is non-convex, but the identity rewrites it as a linear combination of and (amplitudes are linear coefficients). Euler packages this in complex form.
Discrete Fourier transform and its inverse
Inversion proof (geometric sum / Euler). Substitute into the inverse:
The inner sum: if every term is , total ; if , geometric series
(numerator since ). So the inner sum is , and the whole thing is .
The Fourier frequencies give exact reconstruction; the basis vectors are orthogonal (same geometric-sum argument on ). The are typically sparse — a few frequencies carry the signal — which is why this is great for compression.
Periodogram and spectral density
Periodogram (sample power at frequency ):
(only to by symmetry ). Divide by because white-noise coefficients scale like , so keeps noise at a constant floor while true signals grow with .
White-noise periodogram is not flat-looking. It shows random spikes, and a fresh sample gives entirely different spikes — white noise is an equal-weight (high-variance) superposition of all frequencies. Don’t over-read individual periodogram peaks (the §1 lesson, frequency-side).
Time↔frequency duality (sample side). The periodogram is the DFT of the sample autocovariance:
(Proof: expand after centering — legal since the constant-signal DFT is — collect the double sum by lag , recognize .)
Spectral density (population limit): for ACVF ,
the periodogram with true and continuous . It is invertible:
Inversion sketch (continuous orthogonality). Substitute the definition of and swap sum and integral:
The integral is the continuous analogue of the DFT orthogonality used above: (for integer it’s unless ). So only the term survives, leaving . The form follows because is symmetric, killing the imaginary part. ∎ (Same orthogonality move as the DFT inversion, run in the continuum.)
So the spectral density and the ACVF carry identical information — switch freely. White noise: ⇒ , flat (equal power at all frequencies — and clearly not a probability density).
Linear filters
An LTI filter (differencing, smoothing, lagging are all special cases). Its effect on the spectrum is multiplicative:
Derivation. From , write each as a spectral integral and factor:
and the integrand multiplying must be .
Worked filter. Lag- differencing : . For this is at (kills constants) and rises toward high — a high-pass filter. For it has zeros at — it removes exactly the period-6 seasonal frequencies.
Spectral density of ARMA. For causal ARMA,
As traces the unit circle, near a root of the denominator → and peaks (AR resonances); near a root of the numerator → and dips (MA nulls). This is the frequency-domain echo of “roots govern everything.”
Aliasing. Sampling too slowly folds high frequencies onto low ones (the helicopter-blade-stops illusion at 24 fps). Sample fast enough or high frequencies masquerade as low — critical for audio.
Process representation — building a series with a target spectrum
The spectral density isn’t just a diagnostic; it tells you how to construct a process with prescribed frequency content. Represent
with uncorrelated, mean zero, . This is stationary with .
Why it approximates a target — derivation. Choose and . Then
As this Riemann sum (step over ) becomes
(last step by symmetry of and ) — exactly the inversion formula. So has spectral density in the limit. ∎ This makes concrete the opening picture: a stationary process is a superposition of random sinusoids, weighted by the spectrum.
Implications of §7.
- ACVF ⟷ spectrum is a lossless change of basis; pick the view where the operation is simple (filtering is multiplication in frequency).
- The same geometric-sum identity underlies DFT inversion, basis orthogonality, and the duality theorems — one move, many corollaries.
- ARMA roots show up as spectral peaks/dips, tying §3’s algebra to what you see in a periodogram.
Core competency set §7.
- Prove DFT inversion via the geometric sum; sketch the continuous-orthogonality version for the spectrum.
- State the ACVF↔spectrum pair and the white-noise flat spectrum.
- Derive and read a differencing filter’s power transfer.
- Write the ARMA spectral density and explain peaks/dips from roots.
- Build a process with target spectrum via random sinusoids () and show the Riemann-sum limit.
8. State space and hidden Markov models
Picture to hold. A latent process evolves; you see only noisy measurements . Want past/present/future of (smoothing/filtering/prediction). GPS: a true trajectory, scattered measurements — recover the path. This generalizes everything above and links to [[07_Bayesian_Statistics]] (EM) and [[05_Stochastic_Processes]] (Markov).
Hidden Markov model assumptions. is a Markov chain (future ⊥ past given present ); given , the are conditionally independent (measurement errors independent, not systematic). The joint factorizes:
Draw as a DAG: .
Linear state space model: , (position/velocity + noisy location). A causal/invertible ARMA is a state space model — stack lags into the state.
AR(2) as state space, worked. . State : This is the state augmentation move — bundle history into the state so the dynamics become first-order Markov. (Cross-link [[07_Bayesian_Statistics]] augment-then-marginalize.)
Filtering and prediction (the forward recursion)
Let . Prediction (), filtering (), smoothing (). With transition matrix () and emission matrix ():
Prediction step: .
Update step — derive via Bayes. We have the model as , ; filtering needs the reverse condition. Using with , , , and dropping the observed past inside the emission (HMM conditional independence):
So the recursion alternates predict (, multiply by ) and update (, reweight by the emission and renormalize) — the HMM forward algorithm. Start from a prior (often uniform). Predicting : .
Smoothing — the backward pass
Filtering uses data up to ; smoothing uses all data to estimate a past state () — better, because the future is informative about where you were. Define forward (filtered, unnormalized) messages from the forward pass, and backward messages
the likelihood of all future observations given the current state. The backward recursion runs , conditioning on the next state and marginalizing it out:
(Read right to left: from state , transition to each next state with prob , emit with prob , then carry the rest of the future .) The smoothed posterior multiplies the two passes:
— past evidence () times future evidence (), renormalized. This forward–backward algorithm is exactly the E-step quantity EM needs below; it is the discrete cousin of the Kalman smoother.
Most likely trajectory — Viterbi
Find . Take logs; the normalizer is constant in , so
Read each term as a cost of traversing states over time: a start cost, a transition cost per move, an emission cost per stay. Minimizing total cost = shortest path through the trellis. Viterbi does it in one forward pass (cheapest path to each state at each time) + a backward trace — instead of brute force.
Parameter estimation — EM / Baum–Welch
When are unknown, the likelihood
sums over exponentially many latent paths — non-convex, generally non-unique. EM (Baum–Welch) alternates: (E) estimate the latent distribution given and current (the forward–backward recursions); (M) update . Cross-link [[07_Bayesian_Statistics]] — same EM as for mixtures, here on a chain. Caveats: can diverge or stick in local optima (restart from random seeds). Hard EM replaces the E-step distribution with the single most likely path (Viterbi) — a Viterbi step + an MLE step.
Implications of §8.
- State augmentation unifies AR/ARMA with Kalman-style filtering — “stack the history” turns any finite-memory model Markov.
- Filtering is recursive Bayes: predict-then-update, the discrete Kalman filter; it’s why HMMs scale to long series.
- Viterbi (max path) vs forward (sum over paths) is the recurring max-vs-sum duality; both are dynamic programming over the trellis.
Core competency set §8.
- State the HMM factorization and write an AR(2) in state space form.
- Derive the filter update from Bayes; state the predict/update alternation.
- Write the backward recursion and the smoothing product (forward–backward).
- Write the Viterbi log-decomposition and explain the DP cost-path reading.
- Say what EM/Baum–Welch and hard EM do and their failure modes.
9. Memorize cold
Must be instant:
- Weak stationarity: constant mean; (lag only); ; .
- WN band ; expected exceedances .
- kills linear trend; kills quadratic; kills period- season.
- Variance-stabilize: ; .
- MA(q): ; ACF cuts off after ; invertible on .
- AR(p): ; PACF cuts off after ; causal on .
- AR(1): , , .
- Geometric-series inversion: .
- Yule–Walker: , symmetric Toeplitz.
- ACF cuts off → MA order; PACF cuts off → AR order.
- AIC () for prediction; BIC () for the true model.
- Time-series CV: train past, validate future only.
- Ljung–Box .
- Spectral density ; WN ⇒ flat ; filter ⇒ ; ARMA .
- HMM filter: predict , update reweight-by-emission-and-renormalize.
- HMM smoothing: (forward × backward).
Rederivable on demand: MA(1) stationarity, AR(1) uniqueness (remainder ), Yule–Walker from covariancing both sides + the AR(2) solve, the PACF-cutoff argument, DFT inversion, , the process-representation Riemann-sum limit, the filter recursion from Bayes, the backward recursion, Viterbi log-decomposition.
Named moves (cross-track glossary)
- Invert-via-geometric-series — treat as a scalar, expand ; converts AR↔MA and divides ARMA polynomials. (§3, §4)
- Roots-outside-the-unit-circle — one condition, two names: causal (AR) / invertible (MA); also locates spectral peaks/dips. (§3, §7)
- Difference-to-stationary — remove trend/season without estimating it; one ∇ per polynomial degree, per season; beware over-differencing. (§2)
- Time↔frequency duality — ACVF and spectrum are the same info; transform to make the operation easy (filtering = multiplication). (§7)
- State augmentation (“stack the history”) — bundle lags into a Markov state; turns ARMA into a state-space/Kalman problem. Mirrors augment-then-marginalize in [[07_Bayesian_Statistics]]. (§8)
- Predict-then-update — recursive Bayes filtering; the discrete Kalman filter / HMM forward pass. (§8)
- Delta method — variance of a transform via first-order Taylor; here for variance stabilization, same tool as in [[03_Statistical_Inference]]. (§2)
- Recognize-the-shape — match ACF/PACF cutoff-vs-decay to model order; the time-series version of the [[07_Bayesian_Statistics]] move. (§4)