Act II · The Mathematical Toolkit
Part 7 of 43Time Series and Volatility
Returns cannot be forecast. Can their volatility, and by how much does a neural network beat a three-line model from 1986?
Under the noise of returns there is a slow river: volatility is persistent, mean-reverting and measurable. The part builds the forecasters in historical order (ARMA for the mean, GARCH and its asymmetric relatives for the variance, realized volatility from intraday data, HAR) and then trains recurrent and transformer networks on the same data. All of them are scored out of sample with a loss that cannot be gamed, and the race is shown as it was run, seeds and all.
What you need. Part 6's regression and likelihood.
What you will be able to do
Undergraduate
- Explain stationarity and volatility clustering, and fit a GARCH(1,1) to daily returns.
- Compute realized volatility from intraday returns.
Master's
- Test for unit roots and cointegration; fit regime-switching and state-space models.
- Score variance forecasts with QLIKE and compare them with Diebold-Mariano and the model confidence set.
PhD
- Explain why Diebold-Mariano degenerates for nested models and derive the Clark-West correction; weigh the evidence for rough volatility.
Industry
- Build a volatility forecast a desk would use: which inputs, which horizon, how it is monitored.
Contents
Each chapter has a home level. Choose a track to see what to read and watch: Undergraduate 17 min · Master's 49 min · PhD 57 min · Industry 23 min.
- 0The river under the noiseUndergraduate3 min
- 1Stationarity, ARMA and Box-JenkinsUndergraduate3 min
- 2Unit roots and spurious regressionMaster's4 min
- 3CointegrationMaster's2 min
- 4Hidden regimesMaster's3 min
- 5The Kalman filter and stochastic volatilityMaster's4 min
- 6ARCH and GARCH by maximum likelihoodUndergraduate3 min
- 7Stationarity, fat tails and asymmetry: the GARCH zooMaster's3 min
- 8Correlations that moveMaster's3 min
- 9Realized volatilityUndergraduate3 min
- 10Jumps and HARMaster's2 min
- 11Is volatility rough?PhD1 min
- 12Scoring forecasts honestlyMaster's3 min
- 13Training the networksMaster's3 min
- 14The raceUndergraduate3 min
- 15Foundation models and the frontierPhD3 min
- 16March 2020Industry2 min
- 17Industry: volatility forecasting for moneyIndustry2 min
- For the researcher: comparing nested forecastsPhD4 min
- 18The volatility forecasterIndustry1 min
- Recap, desk questions, problemsAll tracks2 min
Also on this page: Lecture · Key results · Try it · Lab · Problems · Reading · 中文 · Build the film.
Lecture
The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film. A dashed box stands for a number the film computes when it is rendered (hover over it to see what is computed); the README's figures for each chapter, where it lists them, follow the chapter's text.
The river under the noiseUndergraduate3 min
Time series and volatility. Part one found weak linear dependence in returns, and stronger persistence in their size. This part builds the models that forecast it, and puts them in a race.
Almost a century of the American market, each bar the RMS of four daily observations sampled every five trading days, roughly one bar per trading month. Big moves do not arrive alone. They come in clusters: the early nineteen thirties, 1987, 2008, March 2020. Benoit Mandelbrot saw it in cotton prices in 1963: large changes tend to be followed by large changes, of either sign. So, pause and predict. Can you forecast tomorrow's sign? And can you forecast tomorrow's size? The bright line is the slow, hidden quantity that the clusters suggest: volatility.
The data answer. Correlate each day's return with an earlier return. Linear correlations in this US sample are small: lag one is . That does not prove directions are unpredictable or rule out trading signals. For absolute returns, lag one is , still a hundred trading days later. Magnitudes show much stronger persistence; slow sample decay alone does not establish mathematical long memory.
The same holds in a market that never closes. Three and a half years of Bitcoin, one bar per day. Five-minute returns give a daily volatility measurement, one noisy dot. A Kalman filter tracks a slower level. Its parameters use the full sample, so this river is a retrospective illustration. Conditional risk can be forecast without predicting each day's direction, and option prices, risk limits and position sizes depend on those forecasts.
How we got here. In 1927 Udny Yule modelled sunspots as a series that remembers its past: the first autoregression. In 1960 Rudolf Kalman published his filter for hidden states. Box and Jenkins made model building a craft in 1970, and Dickey and Fuller tested for random walks in 1979. Then volatility: Engle's ARCH in 1982, Bollerslev's GARCH in 1986, Engle and Granger's cointegration in 1987, Hamilton's regimes in 1989. In 1994 J.P. Morgan gave away RiskMetrics. Intraday data made volatility measurable, and in 2003 Engle and Granger shared the Nobel prize. HAR in 2009, rough volatility in 2018, and foundation models since 2024. Each gets a chapter.
The plan. Time-series foundations: ARMA, unit roots and cointegration. Hidden states. The GARCH family, derived and fitted. Realized volatility, HAR and roughness. Then scoring, networks trained here, the race and foundation models. And March 2020, and the industry.
In the House, this part builds the volatility forecaster: the measures, the models and the scoring rules. When the volatility desk opens in Part ten, this is the engine it runs on.
1Stationarity, ARMA and Box-JenkinsUndergraduate3 min
The simplest series that remembers: keep a fraction phi of yesterday's value, add a fresh shock. At phi zero, pure noise. Turn phi up to a half: the path smooths, and its autocorrelation decays geometrically, phi to the power of the lag. At zero point nine the series wanders in long swings, and its variance has grown five-fold. At zero point nine nine, a shock takes almost seventy steps to lose half its effect. It is a ball on a spring, kicked by shocks. For absolute phi below one, with a stationary start and independent unit-variance shocks, the series is stationary: its mean and variance stay put, and its correlations depend only on the lag.
Why those numbers. Substitute the recursion into itself, and the series is a weighted sum of all past shocks, with weights phi to the k. Shocks are independent, so their variances add: a geometric series, sigma squared over one minus phi squared. Multiply by the value k steps back and take expectations: the autocorrelation is phi to the k. Iterate forward, and the forecast decays toward the mean at the same rate, which gives the half-life. To test whether anything is left, Greta Ljung and George Box summed the squared autocorrelations of the residuals: asymptotically chi-squared under suitable white-noise assumptions; adjust the degrees of freedom for fitted ARMA residuals. And Herman Wold proved in 1938 that every centered, purely nondeterministic covariance-stationary series is a moving average of its past surprises; ARMA writes those weights compactly.
How do you tell which model you have? By the fingerprints. An autoregression's autocorrelations decay slowly, but its partial autocorrelations, the correlation left after accounting for shorter lags, stop dead after lag p. A moving average is the mirror image: its autocorrelations stop after lag q. Box and Jenkins turned that into a loop. Identify a candidate from the fingerprints, estimate it, check the residuals with the Ljung-Box test, and look for remaining dependence; passing one test does not prove independence. The spectrum carries the same information in frequency; this part stays in time.
Lab. The House's autoregression: lagged values and least squares. Run it on the logarithm of the VIX, trading days from 1990 to 2020. Phi comes out at : fear decays with a half-life of about trading days.
Let the Akaike criterion choose among candidates. ARMA(,) wins, but its residuals still fail the Ljung-Box test: serial dependence remains in this limited candidate set; that alone does not establish long memory. Last, Ljung-Box on ninety-four years of daily returns: Q is , a raw Ljung--Box statistic whose usual calibration needs stronger assumptions than zero correlation under changing volatility. On squared returns, Q is , about times larger. The level barely remembers; the size remembers enormously. Pause and predict: as phi goes to one, what happens to the variance and the half-life? Both go to infinity, and that is the next chapter.
2Unit roots and spurious regressionMaster's4 min
Let phi reach one, and the spring snaps. On the left, sixty stationary paths with constant-width pointwise two-standard-deviation bands; these are not bounds on whole paths. On the right, sixty random walks from the same shocks. Every shock is permanent, and the paths fan out in a funnel that widens like the square root of t. This is a unit root, a useful benchmark for log prices rather than a fact established for every price series.
To test for a unit root, regress the change on a constant and yesterday's level and look at the coefficient's t-statistic. Under the unit root it is not normal. Watch. Twenty thousand simulated random walks, each regressed, their t-statistics piling up. The pile sits to the left of the normal curve and is skewed. Its mean is about , not zero, and percent of the walks would be rejected at the textbook five percent level. The true five percent point settles at , the number David Dickey and Wayne Fuller tabulated in 1979.
Why it is not normal. Fit a constant, as in the simulation. Square the walk, telescope, and subtract the lagged-level mean times the final level. Scale the walk by the square root of T, and Donsker's theorem turns it into a Brownian motion; demeaning the regressor gives W mu. So the estimated coefficient, scaled by T, converges to a ratio of two random quantities built from that Brownian path, and so does the t-statistic. The numerator also subtracts the final Brownian value times its path average. This is the fitted-constant Dickey--Fuller law, which matches the simulation. Adding a trend changes it again.
Two practical details. The critical value depends on what else is in the regression. With no constant, the five percent point is minus one point nine four. With a constant, which allows the series a non-zero mean, it is minus two point eight six, the number we simulated. With a time trend as well, minus three point four one: each deterministic term the regression must estimate pushes the distribution further left. And if the changes are themselves autocorrelated, the plain test is distorted, so the augmented test adds lagged changes, enough to whiten the residuals. Choosing the terms wrongly is the most common way to get a unit-root test wrong. Yet two series with unit roots can still be tied together. Next: cointegration.
Lab. The House's test: regress the change on a constant, yesterday's level and five lagged changes, and compare the t-statistic with minus two point eight six. Run it on four series. Pause and predict first: the ten-year Treasury yield can't go to infinity. Does it have a unit root? Bitcoin's log price and the stock market's log index: the unit-root null is not rejected. As for the VIX:
Unit roots matter because regressing one wandering series on another is a trap. Clive Granger and Paul Newbold showed it in 1974. Take two thousand pairs of random walks that have nothing to do with each other, and regress one on the other. The t-statistic exceeds two in percent of them. In changes, five percent, as it should be. Peter Phillips proved why in 1986: in levels, the slope does not converge to zero but to a random number, so as the sample grows the t-statistic grows like the square root of T. From fifty days to two thousand it grows -fold. More data, a more confident lie. Bitcoin against the American stock market, in log levels: a t-statistic of twenty-four. In daily changes the link is real but weak: five percent of the variance, most of it from 2020.
3CointegrationMaster's2 min
In 1994 Michael Murray explained cointegration with a drunk and her dog. The drunk is a random walk; the dog follows with a stationary tracking gap. Each position can wander. Their east-west coordinate difference stays stable: its ADF statistic is , against on her position. Non-rejection alone would not prove a unit root, though we know this simulation's construction. Cointegration means I-one series have a stationary linear combination; Euclidean leash length is a related nonlinear picture.
A real leash. The ADF tests do not reject unit roots in spot or perpetual prices; I-one is our working model. The 2020 basis is more stable, including the March crash. Engle and Granger's residual test rejects its unit-root null using the appropriate critical value. Twenty basis points away from the fitted mean today becomes about tomorrow under the fitted AR coefficient . That is a conditional mean forecast, not a guaranteed trade; funding and arbitrage help connect the prices.
The algebra. Two series are cointegrated when each has a unit root but some combination of them is stationary. Granger's representation theorem says that is the same as an error-correction model: each period, at least one series moves to close a fraction alpha of yesterday's gap. For two variables with a fitted constant and no trend, the asymptotic residual-test critical value is about minus three point three four: estimating the levels regression changes the residual-test null distribution. With more than two series, Soren Johansen wrote the system in levels and differences: the levels enter only through a matrix pi of reduced rank. Its rank, the number of independent leashes, is read from the canonical correlations between changes and lagged levels after purging lagged differences and deterministic terms, by the trace test.
Johansen's test, made visible. Treasury yields in three dimensions, one point per sampled day from 1990 through 2020. The long direction mainly describes the level of rates. Seen edge-on, the cloud is thin. This PCA geometry neither proves cointegration nor identifies the fitted cointegrating vector. Under a two-lag VAR with a constant and no trend, the trace test gives this conditional rank verdict. Hall, Anderson and Granger studied Treasury-bill cointegration in 1992. Yield factors return in Part nineteen, pairs in Part thirty-three. Next: hidden regimes.
4Hidden regimesMaster's3 min
Volatility is hidden; we only see its effects. One way to model it is a few hidden states. In 1989 James Hamilton let the economy switch between regimes by a Markov chain, each regime with its own mean and volatility. Picture two jars of belief: calm and storm. Each month, two things happen. First, predict: a little liquid leaks between the jars, because regimes can change. Then the month's return lands, and each jar is rescaled by how likely that return is under its regime, here the two bell curves, and the total is poured back to one litre. Watch it through 1929. Every big monthly move tips the belief toward the storm, and it stays there. With parameters fitted to the full sample, this retrospective filter runs over the century, and the red area it draws lights up the Depression, 1974, 1987, 2008 and 2020.
In symbols. The update is Bayes' rule: multiply the predicted probabilities by each regime's density of the return, and renormalise. The prediction multiplies by the transition matrix. A regime that persists with probability p each month lasts a geometric number of months, with mean one over one minus p. And the long-run share of time in the storm balances the flows in and out. With the fitted probabilities, a calm spell lasts about months on average, a storm about , and the market spends about percent of its time in the storm.
How the parameters are found. The filter only looks backwards; for estimation we may use hindsight. Kim's smoother runs from the last month back to the first and revises every month's probabilities with everything that came after. Then the maximisation step is weighted least squares: each regime's mean and variance are the averages of the months, weighted by how likely each month was to belong to that regime. And each transition probability is the expected number of moves from one regime to the other, over the expected time spent in the first. Expectation, then maximisation, repeated: Arthur Dempster, Nan Laird and Donald Rubin's algorithm of 1977, whose exact steps do not lower the likelihood, without guaranteeing a global optimum. A regime is a hidden state that jumps. Next: a hidden state that drifts, and the filter that tracks it.
How are the regimes found? By expectation-maximisation: guess the two regimes, run the filter and a smoother to get each month's probabilities, re-estimate each regime's mean and volatility from the months weighted by those probabilities, and repeat. Exact EM does not lower the likelihood, but can converge to a local optimum. On ninety-four years of monthly returns most likelihood gain comes in the first few iterations, while convergence continues: a calm regime with a mean of percent a year and percent volatility, and a storm with a mean of percent and percent volatility. Pause and predict. A month of minus eight percent arrives while the model is sure it is calm. Does the storm jar fill?
5The Kalman filter and stochastic volatilityMaster's4 min
Kalman's filter of 1960 does for a continuous hidden state what Hamilton's jars do for a discrete one. Hold a belief about today's hidden log volatility: a bell curve, its centre the best guess, its width the uncertainty. Predict: overnight the hidden level may have drifted, so the bell widens. Observe: today's realized volatility arrives, a measurement with its own, wider bell of noise. Update: multiply and normalize the two bells under independent Gaussian state and measurement noise. The posterior is narrower than either, and its centre moves a fraction K of the way toward the measurement. K is the Kalman gain. Day after day: widen, observe, pull and narrow.
The derivation. The hidden level drifts with variance q, the measurement adds noise r, and predicting adds q. Bayes multiplies the prior by the likelihood of the measurement, and completing the square gives the rules: precisions add, and the mean moves by the gain K, the prior variance over the prior plus the noise. In steady state, the widening each night and the narrowing each day balance, and the gain depends only on the signal-to-noise ratio. Bitcoin's log volatility has a ratio of about , so each day the belief moves percent of the way to the new measurement. Pause and predict: if the measurements get noisier, does the belief move more, or less? Less: r rises, the ratio falls, and K slides down the curve.
Lab. Here is the House's filter: four lines inside a loop, widen, gain, pull, narrow. The noise variances q and r are estimated, and initial variance is set, using the full research sample, so this is a retrospective filtered illustration, not a real-time backtest. Run it on Bitcoin's daily log volatility, and the river from the start of this part draws itself, with its band of uncertainty.
The same filter gives a model of volatility. Let the log variance be a hidden autoregression: stochastic volatility. The squared return is a very noisy measurement of it. Take logs, and the under standard-normal return shocks the log squared noise has these known moments. Andrew Harvey, Esther Ruiz and Neil Shephard treated it as Gaussian in 1994, and the Kalman filter gives a Gaussian quasi-likelihood for the non-Gaussian log chi-squared noise. On ninety-four years of daily returns, phi is : a half-life of about trading days. The smoothed volatility tracks the GARCH model of the next chapter Two very different models, one hidden river.
Conditional on fitted parameters, the filter uses observations only up to each day; the smoothed path drawn a moment ago used hindsight. Herbert Rauch, Frank Tung and Charlotte Striebel's smoother of 1965 runs the filter backwards: each day's estimate is corrected by the surprise in the next day's smoothed value, weighted by how much the two are linked. The model also has a long-run level, the mean of the hidden log variance: , which gives stationary median annual volatility of about percent, not the unconditional mean. That is below the market's average volatility, because the average of a log sits below the log of the average: the typical day is calmer than the average day. For forecasting, use the filter; for history, the smoother. Stochastic volatility treats volatility as hidden. GARCH makes it a function of past returns, far easier to fit. Next.
6ARCH and GARCH by maximum likelihoodUndergraduate3 min
Robert Engle, on a sabbatical at the London School of Economics, wanted to model how uncertain British inflation was. His answer, published in 1982: the variance of today's surprise depends on yesterday's surprise. That is ARCH. Picture the variance as water in a bucket. A tap pours in a steady trickle, omega. Each night it keeps a fraction beta and leaks the rest. Each day a return is drawn, its size in proportion to the square root of the water level, and it splashes alpha times its square back in. Run it. A high level makes big returns, big returns make big splashes, and clusters appear by themselves. With positive omega, nonnegative coefficients and alpha plus beta below one, the conditional expected level reverts to the finite long-run variance; individual paths keep receiving shocks.
The equations behind the bucket. Today's return is the volatility times a standard shock, and in 1986 Tim Bollerslev let the variance remember itself as well as yesterday's squared return: GARCH. Take expectations, and the long-run level is omega over one minus alpha minus beta. Unroll the recursion: the variance is an exponentially weighted average of all past squared returns, sitting above a floor. To fit it, write the Gaussian density of each day's return given its variance and multiply across days: the likelihood if shocks are normal, a quasi-likelihood otherwise. Forecasts revert to the long run at the rate alpha plus beta, and rewritten, GARCH has an ARMA identity for squared returns, with finite fourth moments needed for a covariance-ARMA interpretation. This helps explain why the last chapter's Ljung-Box test on squares failed so badly.
Lab. The House's GARCH is five lines of recursion and one line of likelihood; the optimiser does the rest. On days of the American market, alpha comes out at about a tenth and beta at about nine tenths. Pause and predict: alpha plus beta is . After a shock, how many days until half of it is gone? trading days, about three months. And here is the fitted volatility, drawn day by day through the century.
What did the optimiser do? Fix omega by matching the long-run variance to the sample's, and the likelihood becomes a landscape over two numbers: alpha, the splash, and the persistence, alpha plus beta, which must stay below one. Start from a poor guess and let a simplex search climb. It races up the steep persistence slope, then crawls across alpha, through iterations, to the peak at alpha and beta . The hill is steep across persistence and broad along alpha: the geometry shows different sensitivities in these coordinates. A precision ratio would require a curvature or robust covariance calculation. And J.P. Morgan's RiskMetrics exponential average sits at the far edge of the landscape: persistence exactly one, no tap and no net expected leak, so it never reverts to a long-run level. Next: GARCH's many children.
7Stationarity, fat tails and asymmetry: the GARCH zooMaster's3 min
Every GARCH is a point on this plane. Below alpha plus beta equal to one, the variance is finite. The American market sits just under the line, Bitcoin a little further in. What happens above it? Daniel Nelson showed in 1990 that a strictly stationary law can exist even with infinite unconditional variance. The process settles down whenever the average of the log of alpha z squared plus beta is negative, and that boundary, in red, lies beyond the line. Pause and predict. Alpha zero point three and beta zero point seven five add up to one point zero five; so do zero point two five and zero point eight. Which has a stationary law under the stated Gaussian shocks?
Why. Unrolled, the variance is a sum of products of random factors. By the law of large numbers, a long product behaves like the exponential of k times the average log factor, so the sum converges exactly when that average is negative. By Jensen's inequality the average log is below the log of the average, so with positive alpha and nonconstant squared shocks, integrated GARCH can be strictly stationary despite infinite variance. And the Gaussian likelihood's score has mean zero under unit conditional shock variance. Identification and ergodic regularity can give consistency; normal sandwich standard errors additionally require finite score variance, which very heavy tails can violate: Tim Bollerslev and Jeffrey Wooldridge, 1992. And two members of the zoo give bad news its own weight: GJR adds a term only after falls, and Nelson's EGARCH models the log of the variance, with a signed term.
Draw tomorrow's variance against today's return: the news-impact curve. For GARCH it is a symmetric parabola: a fall and a rise of the same size count the same. Markets disagree. Fischer Black noticed in 1976 that volatility rises more after falls. Fit GJR to the American market and the parabola tilts: a fall raises tomorrow's variance times as much as a rise. EGARCH, working in logs, bends it differently, and both fit far better than the symmetric model. Bitcoin, with no corporate leverage behind it, shows the same tilt: corporate leverage cannot be the only possible explanation, but this fit alone does not identify the cause.
Last, the tails. Divide each day's return by GARCH's volatility. If the shocks were normal, these standardized residuals would line up on the diagonal against normal quantiles. They don't: the ends curl away, and the kurtosis is , not three. GARCH explains part of the fat tails of returns, not all of them. Give the shocks a Student-t distribution and estimate its degrees of freedom: about . Now the points straighten, and the log-likelihood rises by . The volatility path barely changes; the tails do, and the tails are what risk managers are paid to get right. One asset's volatility is half the story. Next: correlations that move.
8Correlations that moveMaster's3 min
Volatilities move, and so do correlations. Here is one ellipse per year: the spread of daily returns of American stocks across, and ten-year Treasury bonds up, from 1962. Watch it breathe as volatility rises and falls, and watch it tilt. Through the inflationary seventies and eighties it leans up: stocks and bonds fall together. Around 2000 it straightens, then leans the other way: bonds rise when stocks fall. The needle tracks the correlation. The sign change improved diversification in this illustration; it was not the sole cause of sixty-forty performance.
How to model it. A full multivariate GARCH for a hundred assets has over fifty million parameters; even the restricted BEKK form has twenty-five thousand. Robert Engle's dynamic conditional correlation of 2002 needs three hundred and two dynamic coefficients, plus the correlation target entries. Split the covariance into volatilities and correlations. Fit a GARCH to each asset, then run a GARCH-like recursion on the products of their standardized shocks, rescaled each day into a proper correlation matrix. The likelihood splits in two, so it is estimated in two easy steps. On stocks and bonds, b is : correlation shocks are very persistent.
Why the recursion is safe. Unroll it, and today's matrix is a weighted sum of the long-run matrix and of outer products of past shocks. With a positive definite target and start, nonnegative a and b, and their sum below one, Q stays positive definite and normalization gives a valid correlation matrix. Multi-step forecasts are nonlinear: the expected shock outer product is R, not Q. The exact recursion retains an expected R term; replacing it by Q is only a linearization. For stocks and bonds a plus b is : the a-plus-b persistence summary gives a half-life of about trading days. This is not an exact half-life of normalized correlation forecasts. Correlation regimes are slow, which is why they matter so much to a balanced portfolio and why a model fitted to one decade can be wrong for the next. All these models infer volatility from daily returns. With intraday data we can measure it. Next.
Here is the fitted correlation day by day, with a plain exponential average in grey for comparison: the DCC path is smoother, because its memory is longer. For much of the earlier period, correlation was positive: inflation hurt both. Then it turned. Pause and predict. In 2010 your risk model for a sixty-forty portfolio still assumed a correlation of plus zero point three. Holding realized marginal volatilities fixed, was risk higher or lower? This isolates the correlation assumption retrospectively. In 2022, outside our window, the sign turned again.
9Realized volatilityUndergraduate3 min
Can volatility be measured after the fact? Here is one wild day of Bitcoin, minute by minute: the twenty-sixth of June 2019. Cut the day into half-hours. Each half-hour's return gets a square, with side the size of the move and area its square. Add up the areas: that is realized variance. Cut finer, ten minutes, five minutes: the squares multiply six-fold and shrink, while their total moves far less. In the limit it is the quadratic variation of Part five, integrated variance for continuous noise-free prices, with squared jumps added if present. Andersen, Bollerslev, Diebold and Labys built on this around 2000: volatility becomes observable. At every minute, though, the total creeps up again. Why?
Build the answer point by point. For every day of 2019, compute realized volatility at a sampling interval of an hour, then thirty minutes, and so on down to one minute, and average. The line rises as the interval shrinks: in 2019, one-minute sampling reads percent more than five-minute sampling. Over the whole sample, with the thinner markets of 2017 and 2018, the gap is percent. The culprit is microstructure noise: trades bounce between the bid and the ask, and every bounce adds a little square that has nothing to do with volatility. Pause and predict: is sampling every second better? No: the more often you sample, the more bounces you add up.
The theory. Under continuous, noise-free semimartingale assumptions, squares converge to integrated variance; jumps would add their squared sizes. With regularity, the BNS error scales as one over root n, estimated from quarticity. Independent exogenous price noise adds bias two n eta squared. A two-term MSE approximation balances that bias against sampling error. Our one-minute noise proxy also contains efficient variation, so the -minute plug-in is illustrative, not a validated optimum. TSRV combines sparse and dense grids; the displayed finite-sample denominator matches our code. Realized kernels use autocovariances to cancel noise under their assumptions. Pre-averaging and irregular sampling extend the toolbox.
On three and a half years of Bitcoin: one-minute sums give an average volatility of percent, five-minute sums . The two noise-corrected estimators, using every minute, land near . Bipower variation, next chapter, is lower still. And each day's measure uses a formal continuous, noise-free CLT band; it ignores noise and jumps, with negative variance lower bounds truncated at zero: with five-minute returns, the half-width is typically percent of the variance. Realized variance is a measurement, not the truth, and that will matter when forecasts are scored against it. Next: the simplest model built on that measurement, and still one of the strongest.
10Jumps and HARMaster's2 min
Realized variance counts jumps too: one sudden move, one giant square. Ole Barndorff-Nielsen and Neil Shephard found a measure that ignores it. Instead of squaring each return, multiply its size by its neighbour's. A jump is paired with an ordinary neighbour, so its rectangle stays thin: bipower variation converges to the continuous part alone, and the difference from realized variance is the jumps. Their 2006 test turns the difference into a z-score. On Bitcoin's five-minute returns, percent of days show a jump at the one percent level. And the twelfth of March 2020? z is .
With a measured variance every day, forecasting becomes a regression. Corsi's HAR uses yesterday and trailing five- and twenty-two-observation averages. Those are stock-market trading-week and month conventions; Bitcoin trades every calendar day. The averages move at different speeds. Expanding them gives an AR-twenty-two with tied staircase weights. The fitted log-HAR can mimic slow sample autocorrelation decay over these horizons; it does not establish true power-law memory.
Lab. The House's HAR: three columns, the day, the week's average and the month's, and least squares. Fitted on Bitcoin through 2019, yesterday and the month carry the weight: and , with the week near zero, and an R squared of . But are the coefficients stable? Refit on 252 rolling Bitcoin observations, about eight months, and watch them as the window slides from 2018 to the end of 2020. Yesterday's weight stays near a half, but the week and the month trade places: this short window has difficulty distinguishing them, because the two averages move together.
Pause and predict: if yesterday's realized variance is noisy, should the model trust it less? Quarticity helps estimate measurement uncertainty. Scalar classical independent measurement error gives attenuation; this is not an exact multivariate HAR law. HARQ lets the daily coefficient adjust with quarticity. Here it is negative but weakly estimated, HAR-CJ treats jumps separately, and log-HAR fits logs. Next: roughness.
11Is volatility rough?PhD1 min
How rough is the river? Two simulated paths, with H one half below. These min-max-rescaled panels compare shapes, not estimate H. H point one is more jagged; self-similarity means equality in law. Gatheral, Jaisson and Rosenbaum found H near point one on realized-volatility proxies. Noise, smoothing and finite scales remain alternative explanations for latent volatility.
Lab. The House's estimator fits moment slopes across lags and powers q. Simulated H point one and one half return about and . On Bitcoin log-realized-volatility observations, H is . This proxy estimate does not establish latent roughness. At H one half and q two, the slope is one. An idealized Gaussian rough model gives a power-law predictor; HAR approximates it over finite horizons.
What does H measure? Fractional Brownian scaling holds in distribution, not as identical segments. Its adjacent-increment correlation is two to the power two H minus one, minus one. That is negative for H below one half. At estimated H , this model implies ; it is not a directly measured Bitcoin increment correlation. Suitable rough-volatility, leverage and regularity assumptions yield the short-maturity skew law. Next: scoring.
12Scoring forecasts honestlyMaster's3 min
In 2005 Peter Hansen and Asger Lunde raced three hundred and thirty models and asked: does anything beat a GARCH(1,1)? But the true variance is never observed; every forecast is judged against a noisy proxy. The true variance is one. Slide the forecast, and draw the average loss against the proxy. With the truth as the proxy, both losses are smallest at one. Now make the proxy noisier: a realized variance, then five returns, then a single squared return. The squared error on volatility slides its minimum to the left, to variance forecast , corresponding to volatility near its square root: it targets a different quantity. QLIKE's minimum does not move. That is Andrew Patton's 2011 result, and the sliding is the proof by picture.
Why QLIKE is robust. Compare positive forecasts measurable to the same information set, using a positive conditionally unbiased variance proxy and finite expected losses. Differentiating expected QLIKE targets conditional mean variance. Proxy noise changes expected losses by a forecast-independent term, preserving rankings under those conditions. Taking the square root changes the target through Jensen's inequality. Diebold--Mariano compares average loss differences using a long-run variance. Its normal reference needs a suitable loss-difference CLT and positive finite long-run variance; reused test data and model selection require extra care.
A simulation with a known answer: GARCH volatility, the truth known every day, times over. Offer four forecasts: the truth, eighty percent of it, a hundred and twenty percent, and a sixty-day moving average. Judge them with four losses against three proxies. Pause and predict: against squared returns, under the absolute error on volatility, which wins, the truth or eighty percent of it? QLIKE and the squared error on variance pick the truth under every proxy.
Lab. The House's scoring tools: QLIKE and Diebold--Mariano with a Newey--West variance. Here comparisons are exploratory after reuse of the 2020 sample. Mincer--Zarnowitz calibration requires intercept zero and slope one. Log-HAR's fitted slope is about ; that association alone does not identify its cause. Any recalibration must fit on training or validation observations and face fresh outcomes.
Last, many models at once. The Hansen--Lunde--Nason model confidence set repeatedly tests equal predictive accuracy and removes a worst model. Nominal coverage concerns a best model within a fixed candidate set, under valid dependence and bootstrap assumptions. It is not a guarantee after adaptive model selection. Here, At seventy-five percent, drop out. Next: training the networks.
13Training the networksMaster's3 min
Three networks, each reading the last twenty-two days of log realized variance. An LSTM's gated memory cell is a learned, data-dependent exponential average, like GARCH unrolled. A small transformer looks at all twenty-two days at once and weights them by attention: a learned version of HAR's averages. All three forecast the logarithm, so we use a working lognormal back-transform calibrated from validation residuals, not an exact conditional mean without distributional assumptions. And the third, after Rafael Reisenhofer, Xandro Bayer and Nikolaus Hautsch, is HARNet: its filters and weights start at the training-window log-HAR fit, which differs from the race baseline fitted through December, and optimization then adjusts it using the training loss. Same data, same early stopping, five seeds each.
Watch the learn. On the right, the validation loss for each of the five seeds, the spread as a band. On the left, the network's forecasts for the second half of 2019 at each checkpoint, against what happened. At epoch zero this randomly initialized forecast is nearly flat. Within five epochs it has found the level, within twenty the slow swings. Then validation stops improving, and each seed stops on its own schedule: the first seed's best epoch is . This small-data experiment mostly learns level and persistence; it does not bound what larger datasets or models can learn.
Why stop early? Training loss keeps falling, which can eventually overfit. This seed's validation loss bottoms at epoch , then rises by ; that is evidence for stopping here, not proof of memorizing particular noise. Keep the best validation weights and stop after about thirty non-improving epochs. Networks train through June 2019 and validate on the second half. Classical baselines fit through December. 2020 is excluded from gradients and early stopping, but later reused for comparisons and added models. The separate 2021-onward envelope remains sealed.
Pause and predict: five seeds, the same data and architecture. Will their 2020 scores agree? The LSTM ranges from to ; the transformer's spread is times as wide. Picking a winning seed would add selection freedom. This registered protocol fixes five seeds and averages them, rather than counting a selected seed as a new discovery. HARNet's seeds are much closer, starting from the log-HAR structure.
HARNet's replay looks different. Its first frame is already log-HAR's forecast, and its validation loss starts at , where the others needed twenty epochs to arrive. Training lowers it only to , with its best epoch early; training then continues until the patience rule stops it. The final left panel shows retained best weights, while the right curve shows the full stopping path. The learned filters stay close to where they started: yesterday still dominates, as Reisenhofer and his coauthors found on stock indices. The network is a microscope on HAR: it confirms the structure rather than replacing it.
14The raceUndergraduate3 min
Hansen and Lunde's question, asked of Bitcoin: does anything beat GARCH? Their currency and stock results differed. Networks train through June 2019 and validate on the second half; classical models fit through December. We evaluate 2020 retrospectively: later entrants were added after results and counted. EWMA, GARCH and GJR see daily returns; HAR and HARQ see realized variance; networks average five seeds. All predict next-day realized variance, scored by QLIKE.
Now run the test year, day by day. Each bar is a model's average QLIKE so far, and the bars re-sort as the days go by. Through January and February the leader is : in a calm market the simplest average is hard to beat. Then the twelfth of March. Every bar lurches, and the order is reshuffled in a single day. By December the models that read the log of realized variance are in front, and finishes first, by a whisker.
The results, over the days of 2020. Lower is better. The models that see only daily closes, the exponential average, GARCH and GJR, come last. The models that read the realized variance do better, and the two neural networks do better still. The LSTM beats HAR with a Diebold-Mariano t of minus three. Has it found something? Look at what it forecasts: the logarithm of realized variance, not the variance. Logs tame the spikes that dominate a least-squares fit. So, after seeing these results, we added one more contestant, and the trial counter counts it: HAR again, four coefficients, fitted to the logarithm. It comes first. Against log-HAR, the LSTM's t-statistic is , in log-HAR's favour: no clear evidence of an improvement in this sample, rather than proof of no additional signal. White dots: single seeds. And score the same forecasts by squared error, and the order changes: comes first. A race is only as honest as its loss function.
And the late entrant, HARNet, which started life as log-HAR. Does it beat its own starting point? And the confidence set?
One more check on the race: calibration. Mincer--Zarnowitz targets intercept zero and slope one. The slope closest to one here is , at ; this does not make it best calibrated on every criterion. Log-HAR's slope is . Fit any correction on earlier training or validation data and check fresh outcomes. Same-sample recalibration is a diagnosis, not validated predictive improvement. Next: foundation models.
Here is the whole test year. Each dot is a day's realized volatility. GARCH, which sees only closing prices, follows slowly and overshoots after big days. Log-HAR, reading the whole day's path, tracks the level more closely. These fitted models miss the largest realized spikes; that does not prove no model or information could improve the forecast. A conditional risk forecast predicts a distribution or level, rather than every realized surprise.
15Foundation models and the frontierPhD3 min
Since 2024, foundation models promise to forecast any time series without training on it. Chronos, from Abdul Fatir Ansari and colleagues at Amazon, shows the idea: turn numbers into a language. Take a window of the series, here Bitcoin's daily volatility through the twelfth of March, including the crash, and divide by its average size, so every series lives on the same scale. Cut the scaled range into bins, and each day becomes a token, one of a fixed vocabulary. The series is now a sentence. A transformer is trained, on a huge corpus of other series, to predict the next token, exactly as a language model predicts the next word. Its output is a probability for every bin: a whole forecast distribution.
The published models are not installed here, so the House built a tokenizer-inspired toy: token embeddings and a one-hidden-layer numpy MLP, not a transformer or a replication of Chronos. Its training corpus is synthetic volatility from four families. Watch three seeds learn. The forecast for March thirteenth uses sixty-four days through March twelfth, including the crash; it does not anticipate that crash. The token probabilities learn persistence from the synthetic corpus.
Pause and predict: a model trained only on synthetic series, against four least-squares coefficients fitted to Bitcoin itself. Better or worse? Point the frozen model at 2020, one day at a time. The fan is its ten-to-ninety percent forecast band; the dots are what happened. Its QLIKE is , against log-HAR's . And its fan contains the outcome on percent of days, against a nominal eighty-percent interval; empirical coverage is not guaranteed.
What do the real models do? Brini's July 2026 benchmark compares nine foundation models and eight econometric models on fifty assets. These are published day-ahead per-asset QLIKE ratios averaged across assets. TTM has the best displayed ratio. Sundial and HAR are also narrowly below log-HAR at one day; TTM is the only foundation model ahead across all three reported horizons. The paper's recalibration diagnoses scale effects, and combining TTM with log-HAR performs well on this benchmark. These results are not universal rankings; pretrained data can overlap evaluation periods.
The frontier in one screen: the foundation models of 2024 and 2025, and the volatility papers. Machine learning helps HAR one day ahead on the Dow's stocks; networks pooled across stocks generalise. In the cited financial benchmarks, fine-tuning TimesFM helps, pretraining on financial data helps, and Kronos reports gains on its own benchmark. The honest summary: on volatility, log-HAR is still the bar to clear. Every model here was scored over calm and stormy days alike. Next, the stormiest: March 2020.
16March 2020Industry2 min
In March 2020, as Covid-19 closed one economy after another, everything was sold for cash at once. On the twelfth of March the American stock market fell nine point six percent. Bitcoin fell thirty-nine and a half percent in a day. On Ethereum, according to a later report, about eight million dollars of MakerDAO collateral was auctioned for bids of zero. On the sixteenth the stock market fell twelve percent, its worst day since 1987, and the VIX, the market's own forecast of volatility, closed at eighty-two point six nine, a record.
Here is what each model said on March eleventh about the twelfth. The highest, , forecast percent annualized volatility. Realized volatility was percent. These fitted models missed the magnitude; that does not establish impossibility for every model or information set. Realized measures let them react after the event. Large days can dominate variance squared errors. QLIKE changes their scale and asymmetry, but remains sensitive to extremes; ranking robustness requires the proxy assumptions from scoring.
Here are the weeks around it. Dots are each day's realized volatility, lines are the forecasts made the day before. All three jump after the twelfth. Then all three stay high for weeks while the market calms: volatility decays faster after a shock than models fitted to calmer years expect.
A desk question. Daily volatility is one percent. What is it over a week, and over a year? And when is the answer wrong?
If daily returns have constant variance and zero autocovariances, variances add: one percent daily gives about two point two over five trading days and sixteen over 252. The graph annualizes each horizon: cumulative standard deviation is the square root of summed expected variances; multiply by root 252 over T to get this RMS scale. The constant-variance rule is therefore flat here. GARCH starts at percent and gives horizon-average annualized volatility over a year, toward long-run . Autocovariances change variance aggregation, and quantiles need distributional assumptions. This physical-measure GARCH term structure also differs from risk-neutral option-implied volatility, which contains risk premia.
17Industry: volatility forecasting for moneyIndustry2 min
In October 1994 J.P. Morgan published RiskMetrics. Its daily variance recursion uses decay point nine four; point nine seven was used for monthly forecasts. MSCI acquired the business in 2010. A common decay preserves positive semidefiniteness, with positive definiteness under suitable initialization. Arbitrary entrywise decays can break it; structured heterogeneous models can still be valid. In our US-market grid, . Weekly QLIKE: Both the loss and horizon differ, so this is not an isolated experiment on loss functions.
Factor risk models face this at scale. MSCI's Barra US equity model of 2011, by MSCI's account, estimates correlations with a longer half-life than volatilities, to keep the matrix well-conditioned, and adds a volatility regime adjustment that scales every factor's volatility by a time series of cross-sectional bias statistics. We could not retrieve the exact formula, so here is a replica in that spirit: average each day's squared ratios of return to forecast volatility across portfolios, and smooth. When forecasts run too low, the multiplier rises above one. On the ten size portfolios it spikes in the Depression, to , in 1987, to , and in 2020, to .
Trend followers lean heavily on volatility forecasts. Harvey and coauthors studied volatility scaling; Moskowitz, Ooi and Pedersen used a sixty-day center-of-mass estimate for sizing. Our descriptive US example uses a two-day lag, a ten-times leverage cap, and a ten-percent volatility target. It is gross of trading and funding costs. The plain benchmark is rescaled to the same full-period volatility after the fact. The drawdown is on cumulative simple excess returns, not compounded or log wealth.
Options desks have a forecast in prices. VIX is the S-and-P-five-hundred's thirty-calendar-day implied index; our realized proxy uses French's broader US market over 21 trading days. VIX exceeds that proxy on percent of observations, by volatility points on average. This gap does not identify a variance risk premium: expectations, squares, horizons and index alignment matter. Retrospective regression R squared is percent for VIX and for GARCH. GARCH parameters fit pre-1990, but demeaning uses the research sample; overlapping outcomes use HAC errors. These are descriptive associations, not a fresh point-in-time validation.
For the researcher: comparing nested forecastsPhD4 min
For the researcher: Chapter twelve compared forecasts with Diebold--Mariano. Under a nested squared-error population null, forecast differences can degenerate and ordinary normal inference can fail. We examine one such recursive-estimation setting and the Clark--West adjustment.
Recall the test. Take each day's squared error from the small model, less the big model's. Diebold and Mariano divide the average by its long-run standard error and compare with a normal. But suppose the small model is nested in the big one, and the extra coefficients are truly zero. Then in the population the two models make the same forecast, the differential is identically zero, and the normal approximation has no variance to work with.
And in a finite sample, estimation matters. Define delta as the gap between the two fitted forecasts, including re-estimation of common coefficients. Exactly, the big minus small squared error is delta squared minus twice the small error times delta. Independence from a future innovation alone does not eliminate the whole cross term. Under appropriate estimation and orthogonality conditions, a leading approximation leaves an extra mean-square penalty. In the experiment below the differential leans negative. Recursive nested-model asymptotics are nonstandard and depend on the forecast-to-estimation ratio.
The fix, from Todd Clark and Kenneth West in 2007, is one line. Add back to the big model what its extra parameters cost it under the null: the squared gap between the two forecasts. Then test the adjusted differential one-sided, against a normal. It is not exact, but it is close, and it takes one line of code in the House.
Simulate it. The target is pure noise, and the big model adds a persistent regressor that predicts nothing. The Diebold-Mariano statistic is centred well below zero: the big model is punished for its estimation noise. Clark and West's statistic is centred near zero, close to the normal curve.
Size and power in this simulated DGP. With the null true, Diebold and Mariano reject one time in two hundred and fifty, far below five percent: the test almost never favours the big model. Clark and West reject about three percent, a little conservative, as they reported. With a real slope of point zero five, Diebold and Mariano find it one time in a hundred and Clark and West eight times; at point one, still under four percent against one time in four. Here the unadjusted test has very low power; this is not a universal size or power result.
On real data, Bitcoin's realized variance in 2019 and 2020. HAR against a single lag: HAR's mean squared error is one percent higher, Diebold and Mariano see nothing, and Clark and West, allowing for HAR's extra estimation noise, lean slightly towards HAR without significance. HARQ against HAR: HARQ's error is sixty-five percent higher, dominated by the days of March 2020, when its quarticity term exploded, and both statistics agree. This adjustment changes the test statistic, not realized forecast losses; higher sample MSE does not prove permanent population inferiority.
Three practical research questions. For a mix of nested and non-nested candidates, choose joint inference whose assumptions cover degeneracy and estimation; standard confidence-set output is not automatically valid. Giacomini--White studies forecasting methods with fixed-length rolling estimation under nondegeneracy and regularity, rather than making all nesting harmless. Other losses, including quantiles and expected shortfall, need loss-specific theory. The squared-gap Clark--West formula cannot simply be reused, and this is not a claim that no related methods exist.
Pause and predict. Over two hundred forecasts the average loss differential is minus point zero two with a standard error of point zero three, and the average squared gap between the forecasts is point zero five. For a rough comparison, assume the adjusted statistic also has standard error point zero three, and compute both. Which model do they favour?
Using that rough common standard error, DM is minus point six seven, favoring the small model. The adjusted mean is point zero three, so CW is about one, leaning toward the big model without significance. Compute the actual CW standard error from the adjusted series.
18The volatility forecasterIndustry1 min
The House's data desk now carries a volatility forecaster. Intraday measures, noise corrections, GARCH, stochastic volatility, HAR, hidden states, cointegration and scoring tools. Rule eight is the prospective standard. This 2020 comparison was reused, with later entrants recorded; it was not wholly prospective. The registry counts trials here, and through this part. The separate 2021-onward holdout remains sealed.
Lab. This is how a desk calls it: a recursive plug-in log-HAR illustration with a constant residual-variance correction, not exact multi-step lognormal moments. On the last day of the research window, the thirty-first of December 2020, it says Bitcoin's volatility tomorrow is about percent a year, and percent over the next 22 Bitcoin calendar days, as annualized RMS volatility. For the American market, GARCH's term structure
Rule eight, unpacked, as the prospective standard. Keep evaluation data untouched while choosing models, compare with simple benchmarks, and use loss and inference appropriate to the proxy and nesting. This chapter's 2020 comparison was reused and later entrants counted, so its rankings are exploratory. QLIKE robustness requires a positive conditionally unbiased variance proxy. DM and the confidence set have regularity conditions; nested squared-error comparisons may need Clark--West. Registrations expose search history, and the separate 2021-onward holdout stays sealed.
Recap, desk questions, problemsAll tracks2 min
Part seven in ten lines. Magnitudes have strong persistence; low return autocorrelation does not prove unpredictability. Unit-root inference depends on deterministic terms. Cointegration concerns stationary combinations. Hidden-state models and GARCH describe volatility differently. Correlations move. Realized measures contain noise and jumps; proxy roughness needs interpretation. In this reused 2020 comparison leads QLIKE, without clear evidence over log-HAR. Published foundation results depend on model and horizon. Variance aggregation needs covariance and horizon assumptions.
Four desk questions. One percent daily scales to about two point two over five trading days and sixteen over 252, under constant variance and zero autocovariances. A t-statistic between prices: check integration and use appropriate residual-test critical values. A crash can dominate a squared-error ranking. Compare sensible benchmarks with appropriate loss and inference. At alpha plus beta one, positive omega gives no finite unconditional variance; strict stationarity needs Nelson's log condition. Strict Jensen needs positive alpha and nonconstant squared shocks. Solutions are in the notes.
And eight problems: GARCH's term structure and half-life, GARCH as an ARMA model for squared returns, the bias that noise adds to realized variance and the optimal sampling rate, why QLIKE ranks forecasts correctly, the Kalman gain, the Dickey-Fuller limit, and two at the level of a qualifying exam: why Diebold and Mariano's test leans towards the smaller nested model, and by how much. Solutions, in English and Chinese, are in the notes.
Where this comes back: the volatility desk and the surface from Part ten, stochastic and rough volatility in Parts thirteen and fourteen, pairs trading and yield factors, systematic macro, and the risk models and value at risk of Parts thirty-one and forty.
The textbook chapters this part covers, and the papers it draws on. Empirical examples use the series' own code and public data: French's market returns, FRED yields and VIX, and Binance prices. Simulations have fixed seeds. The published foundation-model comparison is explicitly quoted from the paper.
The House can now forecast how much the market will move. Next, Part eight: decisions and control. Given a forecast, how much should you bet? Utility, dynamic programming, Merton's portfolio problem, and the Kelly criterion, with the controversy that still surrounds it.
Where it goes next. The volatility forecaster feeds option trading (Part 11), risk measurement (Part 40) and volatility targeting (Part 32); roughness is taken up in Part 14.
Key results
The part's results in one place, for revision.
Try it
Lab 7 · Fit a GARCH, then race the forecasts
Simulate a GARCH(1,1) market with known parameters, recover them by the House's quasi-maximum likelihood, and score one-day variance forecasts (GARCH, EWMA, a constant) by QLIKE out of sample.
python -m videos.quant.labs 7
needs numpy, scipy, matplotlib, numba · download lab07.py ·
source on GitHubTrue alpha, beta 0.080, 0.900
Fitted alpha, beta 0.080, 0.905 (persistence 0.986)
QLIKE out of sample, GARCH 1.2666
QLIKE out of sample, EWMA 0.94 1.2768
QLIKE out of sample, constant 1.3273
QLIKE, the true variance 1.2655
QLIKE is minimized in expectation by the true conditional variance; nothing beats the oracle.
The code (65 lines; it asserts its own result)
"""Lab 7: fit a GARCH by maximum likelihood and race it against EWMA and a constant."""
import numpy as np
from videos.quant import labs
from explainer.quant.house import vol
TITLE = "Fit a GARCH, then race the forecasts"
GOAL = ("Simulate a GARCH(1,1) market with known parameters, recover them by the House's quasi-maximum "
"likelihood, and score one-day variance forecasts (GARCH, EWMA, a constant) by QLIKE out of sample.")
TASKS = [
"Fit kind='gjr' to the same data. Is the asymmetry term distinguishable from zero? Then simulate a GJR market.",
"Shorten the estimation sample to 500 days. How far do alpha and beta wander across seeds?",
"Score with vol.mse instead of vol.qlike, then test the difference with vol.diebold_mariano.",
]
def simulate(n, omega, alpha, beta, seed):
rng = np.random.default_rng(seed)
r, h = np.empty(n), np.empty(n)
h[0] = omega / (1 - alpha - beta)
for t in range(n):
r[t] = np.sqrt(h[t]) * rng.standard_normal()
if t + 1 < n:
h[t + 1] = omega + alpha * r[t] ** 2 + beta * h[t]
return r, h
def run(seed=0):
true = (2e-6, 0.08, 0.90)
r, h = simulate(6000, *true, seed)
split = 4000
fit = vol.garch_fit(r[:split])
omega, alpha, beta = fit["params"]
garch = vol.garch_filter(fit["params"], r)[split:]
ewma = vol.ewma(r, 0.94)[split:]
const = np.full(len(garch), r[:split].var())
target = r[split:] ** 2
scores = {name: vol.qlike(f, target).mean() for name, f in (("GARCH", garch), ("EWMA 0.94", ewma),
("constant", const))}
oracle = vol.qlike(h[split:], target).mean()
lab = labs.Lab()
lab.row("True alpha, beta", f"{true[1]:.3f}, {true[2]:.3f}")
lab.row("Fitted alpha, beta", f"{alpha:.3f}, {beta:.3f} (persistence {fit['persistence']:.3f})")
for name, s in scores.items():
lab.row(f"QLIKE out of sample, {name}", f"{s:.4f}")
lab.row("QLIKE, the true variance", f"{oracle:.4f}")
lab.note = "QLIKE is minimized in expectation by the true conditional variance; nothing beats the oracle."
assert abs(alpha - true[1]) < 0.03 and abs(beta - true[2]) < 0.04
assert oracle <= scores["GARCH"] + 0.005 and scores["GARCH"] < scores["EWMA 0.94"] < scores["constant"]
fig, ax = labs.figure(2, size=(11, 4.2), gridspec_kw={"width_ratios": [2, 1]})
days = np.arange(split, split + 600)
ann = lambda v: 100 * np.sqrt(252 * v) # noqa: E731
ax[0].plot(days, ann(h[split:split + 600]), color=labs.INK, lw=1.2, label="true")
ax[0].plot(days, ann(garch[:600]), color=labs.Q, label="GARCH fit")
ax[0].plot(days, ann(ewma[:600]), color=labs.REALIZED, lw=1.1, label="EWMA")
ax[0].set(title="Volatility forecasts out of sample (annualized, %)", xlabel="day")
ax[0].legend(ncols=3)
names = list(scores) + ["truth"]
ax[1].bar(names, list(scores.values()) + [oracle], color=[labs.Q, labs.REALIZED, labs.CASH, labs.INK])
ax[1].set(title="QLIKE (lower is better)", ylim=(oracle - 0.05, max(scores.values()) + 0.02))
ax[1].tick_params(axis="x", labelsize=8)
lab.fig = fig
return lab
Now change it
- Fit kind='gjr' to the same data. Is the asymmetry term distinguishable from zero? Then simulate a GJR market.
- Shorten the estimation sample to 500 days. How far do alpha and beta wander across seeds?
- Score with vol.mse instead of vol.qlike, then test the difference with vol.diebold_mariano.
Problems, with solutions
Try each problem before opening its solution; the last two of each set are at qualifying-exam level.
Desk questions, with solutions
- Daily volatility is 1%. With independent returns and constant variance, variances add: over a week 1% × √5 ≈ 2.2%, over a year 1% × √252 ≈ 15.9%. The rule fails in three ways. Volatility mean-reverts, so from a high level the average over a horizon is lower than today's level (GARCH: E_t[σ²_{t+h}] = σ̄² + (α + β)^{h−1}(σ²_{t+1} − σ̄²)); chapter 16 shows 85% falling to 52% over a year. Autocorrelated returns change the sum's variance by the factor 1 + 2Σ(1 − k/h)ρ_k (Lo–MacKinlay's variance ratio). And quantiles of fat-tailed returns do not scale by √T, because the sum of fat-tailed returns is closer to normal than each one.
- A t of 24 between two prices. First check both series for unit roots (ADF). If both have one, the t-statistic is meaningless (chapter 2: 89% false rejections, and it grows like √T). Test the residual of the levels regression with Engle–Granger critical values (about −3.34 at 5% for two series, not −2.86), or regress changes on changes.
- A model beats GARCH on MSE over a year with a crash in it. Squared errors of variance forecasts are dominated by the largest days, so one day can decide the race. Score with QLIKE, which is robust to noise in the realized proxy (Patton 2011), compare against HAR rather than a weak benchmark, use a Diebold–Mariano test with a HAC variance and a model confidence set, and check that the ranking survives without the crisis weeks.
- A GARCH fit gives α + β = 1. Is the process stationary? Not covariance-stationary: the unconditional variance ω/(1 − α − β) is infinite. With positive α, nonconstant squared iid shocks and log integrability, it can be strictly stationary: unrolling gives σ_t² = ω Σ_k Π_{j≤k}(αz²_{t−j} + β), which converges when E ln(αz² + β) < 0 (Nelson 1990), and by Jensen E ln(αz² + β) < ln E(αz² + β) = ln(α + β) = 0. Forecasts of the variance never revert (the RiskMetrics EWMA is this case with ω = 0).
Problems, with worked solutions
-
GARCH's term structure. For GARCH(1,1), \(\sigma^2_{t+1} = \omega + \alpha r_t^2 + \beta\sigma_t^2\), derive the \(h\)-step forecast \(\mathbb{E}_t[\sigma^2_{t+h}] = \bar\sigma^2 + (\alpha + \beta)^{h-1}(\sigma^2_{t+1} - \bar\sigma^2)\) and the half-life of a shock.
Solution
Write σ̄² = ω/(1 − α − β). Since E_t[r²_{t+k}] = E_t[σ²_{t+k}], taking expectations of σ²_{t+k+1} − σ̄² = α(r²_{t+k} − σ̄²) + β(σ²_{t+k} − σ̄²) gives E_t[σ²_{t+k+1}] − σ̄² = (α + β)(E_t[σ²_{t+k}] − σ̄²), and by induction E_t[σ²_{t+h}] = σ̄² + (α + β)^{h−1}(σ²_{t+1} − σ̄²). A shock halves after log 0.5/log(α + β) days: 63 days for the US market's 0.989.
-
GARCH as ARMA, and its kurtosis. Derive the squared-return ARMA identity and the Gaussian GARCH fourth-moment condition; when finite, derive its kurtosis.
Solution
Let ν_t = r_t² − σ_t², a martingale difference. Substituting σ_t² = r_t² − ν_t into the GARCH recursion gives r_t² = ω + (α + β)r²_{t−1} + ν_t − βν_{t−1}: an ARMA(1, 1) with autoregressive root α + β. With normal shocks, E[r⁴] = 3E[σ⁴]. Taking expectations of the squared recursion gives E[σ⁴](1 − (α + β)² − 2α²) = ω² + 2ωσ̄²(α + β), and the kurtosis is 3(1 − (α + β)²)/(1 − (α + β)² − 2α²). This exceeds 3 whenever α > 0, and is finite only if (α + β)² + 2α² < 1.
-
Noise in realized variance, and the optimal sampling rate. Under continuous prices and independent iid price noise, derive the \(2n\eta^2\) bias and minimize the illustrative MSE \(4n^2\eta^4+2IQ/n\).
Solution
If observed log prices are p_i = p*_i + u_i with iid noise of variance η², observed returns are r_i = r*i + u_i − u{i−1}, and E[Σr_i²] = ∫σ²dt + 2nη²: the bias grows with n (the signature plot). The estimation error of RV without noise has variance 2IQ/n (BNS). The mean squared error is about (2nη²)² + 2IQ/n = 4n²η⁴ + 2IQ/n; setting its derivative 8nη⁴ − 2IQ/n² to zero gives n* = (IQ/(4η⁴))^{1/3} (Bandi and Russell 2008). Two-scale RV removes the bias instead: it averages K sparse grids (bias 2n̄η² each) and subtracts (n̄/n)RV_all, converging at rate n^{−1/6}.
-
QLIKE. With positive conditionally unbiased proxies, measurable forecasts and finite losses, derive the QLIKE target \(\hat h=E[h\mid\mathcal F]\) and ranking robustness.
Solution
E[h/ĥ − log(h/ĥ) − 1 | F] = E[h|F]/ĥ + log ĥ − E[log h | F] − 1. Its derivative in ĥ is −E[h|F]/ĥ² + 1/ĥ, which is zero only at ĥ = E[h|F], and the function is convex there. The loss depends on h only through E[h|F] plus a term free of ĥ, so an unbiased proxy (E[h̃|F] = E[h|F]) adds the same constant to every forecast's expected loss and preserves the ranking (Patton 2011). For MSE on volatility, argmin E(√h̃ − σ̂)² = E√h̃ < √E h̃ by Jensen: with a squared return as the proxy, the minimiser is (2/π)h ≈ 0.64h.
-
The Kalman gain. Write the Kalman filter for a local-level model and show that its steady-state gain depends only on the signal-to-noise ratio.
Solution
For x_t = x_{t−1} + w_t and y_t = x_t + v_t, with variances Q and R, the filter predicts P⁻ = P + Q, uses the gain K = P⁻/(P⁻ + R), and updates P = (1 − K)P⁻. In steady state KP⁻ = Q, and P⁻ solves P⁻² − QP⁻ − QR = 0. Dividing by R² and writing q = Q/R gives p = P⁻/R = (q + √(q² + 4q))/2 and K = p/(p + 1), a function of q alone. For Bitcoin's q = 0.38, K ≈ 0.45.
-
The Dickey–Fuller limit with a constant. For a random walk fitted with a constant and no trend, derive the coefficient and DF \(t\) limits using \(W_\mu=W-\int_0^1 W\) and \(A=\frac12(W(1)^2-1)-W(1)\int_0^1W\).
Solution
Assume x₀ = 0 and iid mean-zero finite-variance shocks. Let x̄₋ be the mean lagged level. The centered numerator is Σ(xₜ₋₁ − x̄₋)εₜ = ½(x_T² − Σεₜ²) − x̄₋x_T. Write Wμ(r) = W(r) − ∫₀¹W(s)ds and A = ½(W(1)² − 1) − W(1)∫₀¹W(r)dr. Donsker and continuous mapping give T(ρ̂ − 1) ⇒ A/∫Wμ² and t_DF ⇒ A/√∫Wμ². The notation ∫Wμ dW abbreviates this explicit path functional, rather than an ordinary adapted Itô integrand. This matches the fitted-constant/no-trend simulation. The uncentered no-intercept law differs; adding a deterministic trend changes the law and critical values again.
-
(qual) Why DM leans small. (qual) Under the stated nested-model orthogonality approximation, show \(\mathbb E[e_2^2-e_1^2]\approx\mathbb E[(\hat y_1-\hat y_2)^2]>0\) and explain the DM bias.
Solution
Under the null the big model's forecast is \(\hat y_2 = \hat y_1 + g\), where the gap \(g\) is the full fitted forecast difference, including refitted common coefficients and regressors at \(t\), known before the shock \(\varepsilon_{t+1}\). Then \(e_2 = e_1 - g\) and \(e_2^2 - e_1^2 = g^2 - 2ge_1\); under additional estimation and orthogonality conditions, \(E[g\,e_1] = E[g\,\varepsilon_{t+1}] + E[g(\text{model 1's estimation error})] \approx 0\) to first order, \(E[e_2^2 - e_1^2] \approx E[g^2] > 0\). So \(E\bar d = E[e_1^2 - e_2^2] < 0\): the statistic is centred below zero, and Clark and West's \(f = e_1^2 - (e_2^2 - g^2)\) is centred near zero.
-
(qual) How much. (qual) In the idealized one-regressor case, derive the mean squared forecast-gap approximation \(\sigma^2\ln(1+P/R)/P\).
Solution
With one extra regressor of variance \(\sigma_x^2\), the recursive slope estimate at time \(t\) has variance \(\approx \sigma^2/(t\sigma_x^2)\), so \(E[g_t^2] \approx \sigma_x^2 \cdot \sigma^2/(t\sigma_x^2) = \sigma^2/t\). Averaging over \(t = R, \dots, R + P - 1\): \(\frac{\sigma^2}{P}\sum 1/t \approx \sigma^2\ln(1 + P/R)/P\). With \(R\) = 100 and \(P\) = 200: \(1.10\sigma^2/200\) per forecast, an order-of-magnitude estimation penalty in this idealized example, not a universal detection threshold.
The research chapter's pause question. DM \(= -0.02/0.03 = -0.67\), favouring the small model; CW's mean is $-0.02 + 0.05 = 0.03$, so with a similar standard error CW \(\approx 1.0\): it leans to the big model, without significance.
Reading and notes
The part's papers
from READING.md
- Kalman, R. E. (1960). "A new approach to linear filtering and prediction problems." J. Basic Engineering.
- Box, G., Jenkins, G. (1970). Time Series Analysis: Forecasting and Control.
- Granger, C., Newbold, P. (1974). "Spurious regressions in econometrics." Journal of Econometrics.
- Dickey, D., Fuller, W. (1979). "Distribution of the estimators for autoregressive time series with a unit root." JASA.
- Engle, R. F. (1982). "Autoregressive conditional heteroscedasticity with estimates of the variance of United Kingdom inflation." Econometrica.
- Bollerslev, T. (1986). "Generalized autoregressive conditional heteroskedasticity." Journal of Econometrics.
- Engle, R. F., Granger, C. (1987). "Co-integration and error correction." Econometrica.
- Hamilton, J. D. (1989). "A new approach to the economic analysis of nonstationary time series and the business cycle." Econometrica.
- Nelson, D. (1991). "Conditional heteroskedasticity in asset returns: a new approach." Econometrica.
- Johansen, S. (1991). "Estimation and hypothesis testing of cointegration vectors in Gaussian vector autoregressive models." Econometrica.
- Glosten, L., Jagannathan, R., Runkle, D. (1993). "On the relation between the expected value and the volatility of the nominal excess return on stocks." Journal of Finance.
- Engle, R. F. (2002). "Dynamic conditional correlation." JBES.
- Barndorff-Nielsen, O., Shephard, N. (2002). "Econometric analysis of realized volatility and its use in estimating stochastic volatility models." JRSS B; (2004) "Power and bipower variation with stochastic volatility and jumps." J. Financial Econometrics.
- Andersen, T., Bollerslev, T., Diebold, F., Labys, P. (2003). "Modeling and forecasting realized volatility." Econometrica.
- Zhang, L., Mykland, P., Aït-Sahalia, Y. (2005). "A tale of two time scales." JASA.
- Hansen, P. R., Lunde, A. (2005). "A forecast comparison of volatility models: does anything beat a GARCH(1,1)?" J. Applied Econometrics.
- Barndorff-Nielsen, O., Hansen, P. R., Lunde, A., Shephard, N. (2008). "Designing realized kernels to measure the ex post variation of equity prices in the presence of noise." Econometrica.
- Corsi, F. (2009). "A simple approximate long-memory model of realized volatility." J. Financial Econometrics.
- Patton, A. (2011). "Volatility forecast comparison using imperfect volatility proxies." Journal of Econometrics.
- Bollerslev, T., Patton, A., Quaedvlieg, R. (2016). "Exploiting the errors: a simple approach for improved volatility forecasting." Journal of Econometrics.
- Gatheral, J., Jaisson, T., Rosenbaum, M. (2018). "Volatility is rough." Quantitative Finance.
- Christensen, K., Siggaard, M., Veliyev, B. (2023). "A machine learning approach to volatility forecasting." J. Financial Econometrics 21(5):1680–1727.
- Ansari, A. F., et al. (2024). "Chronos: learning the language of time series." TMLR.
- Das, A., Kong, W., Sen, R., Zhou, Y. (2024). "A decoder-only foundation model for time-series forecasting." ICML (TimesFM).
- Woo, G., et al. (2024). "Unified training of universal time series forecasting transformers." ICML (Moirai).
- Yule, G. U. (1927). "On a method of investigating periodicities in disturbed series, with special reference to Wolfer's sunspot numbers." Phil. Trans. R. Soc. A.
- Mincer, J., Zarnowitz, V. (1969). "The evaluation of economic forecasts." In Economic Forecasts and Expectations, NBER.
- Ljung, G., Box, G. (1978). "On a measure of lack of fit in time series models." Biometrika.
- Phillips, P. C. B. (1986). "Understanding spurious regressions in econometrics." Journal of Econometrics 33.
- Bollerslev, T. (1987). "A conditionally heteroskedastic time series model for speculative prices and rates of return." REStat.
- Engle, R. F., Lilien, D., Robins, R. (1987). "Estimating time varying risk premia in the term structure: the ARCH-M model." Econometrica.
- Nelson, D. (1990). "Stationarity and persistence in the GARCH(1,1) model." Econometric Theory.
- Bollerslev, T., Wooldridge, J. (1992). "Quasi-maximum likelihood estimation and inference in dynamic models with time-varying covariances." Econometric Reviews.
- Hall, A. D., Anderson, H. M., Granger, C. W. J. (1992). "A cointegration analysis of Treasury bill yields." REStat.
- Engle, R. F., Ng, V. (1993). "Measuring and testing the impact of news on volatility." Journal of Finance.
- Murray, M. P. (1994). "A drunk and her dog: an illustration of cointegration and error correction." The American Statistician 48(1):37–39.
- Harvey, A., Ruiz, E., Shephard, N. (1994). "Multivariate stochastic variance models." Review of Economic Studies.
- Diebold, F., Mariano, R. (1995). "Comparing predictive accuracy." JBES.
- J.P. Morgan/Reuters (1996). RiskMetrics — Technical Document, 4th ed.
- Christensen, B. J., Prabhala, N. R. (1998). "The relation between implied and realized volatility." JFE.
- Andersen, T., Bollerslev, T., Diebold, F., Labys, P. (2000). "Great realizations." Risk.
- Barndorff-Nielsen, O., Shephard, N. (2006). "Econometrics of testing for jumps in financial economics using bipower variation." J. Financial Econometrics.
- Andersen, T., Bollerslev, T., Christoffersen, P., Diebold, F. (2006). "Volatility and correlation forecasting." Handbook of Economic Forecasting vol. 1.
- Andersen, T., Bollerslev, T., Diebold, F. (2007). "Roughing it up: including jump components in the measurement, modeling, and forecasting of return volatility." REStat.
- Bandi, F., Russell, J. (2008). "Microstructure noise, realized variance, and optimal sampling." Review of Economic Studies.
- Carr, P., Wu, L. (2009). "Variance risk premiums." Review of Financial Studies.
- Hansen, P. R., Lunde, A., Nason, J. (2011). "The model confidence set." Econometrica.
- Moskowitz, T., Ooi, Y. H., Pedersen, L. H. (2012). "Time series momentum." JFE (each position sized to 40% ex-ante volatility; EWMA with a 60-day centre of mass).
- Moreira, A., Muir, T. (2017). "Volatility-managed portfolios." Journal of Finance.
- Harvey, C. R., Hoyle, E., Korgaonkar, R., Rattray, S., Sargaison, M., Van Hemert, O. (2018). "The impact of volatility targeting." J. Portfolio Management 45(1).
- Bollerslev, T., Hood, B., Huss, J., Pedersen, L. H. (2018). "Risk everywhere: modeling and managing volatility." Review of Financial Studies.
- MSCI (2011). "Market factor: not just for show." Model Insights, December (USE4's half-lives and volatility regime adjustment, described).
- Zhang, C., Zhang, Y., Cucuringu, M., Qian, Z. (2022). "Volatility forecasting with machine learning and intraday commonality." arXiv 2202.08962.
- Reisenhofer, R., Bayer, X., Hautsch, N. (2022). "HARNet: a convolutional neural network for realized volatility forecasting." arXiv 2205.07719.
- Ekambaram, V., et al. (2024). "Tiny time mixers (TTMs): fast pre-trained models for enhanced zero/few-shot forecasting of multivariate time series." NeurIPS (arXiv 2401.03955).
- Goel, A., Pasricha, P., Magris, M., Kanniainen, J. (2025). Foundation time-series models for volatility forecasting (TimesFM), arXiv 2505.11163.
- Shi, Y., et al. (2025). "Kronos: a foundation model for the language of financial markets." arXiv 2508.02739.
- Ansari, A. F., et al. (2025). "Chronos-2: from univariate to universal forecasting." arXiv 2510.15821.
- Rahimikia, E., Ni, H., Wang, W. (2025). Time-series foundation models for financial returns (FinText), arXiv 2511.18578.
- Brini, A. (2026). "Forecasting realized volatility with time series foundation models: a comparison with econometric benchmarks." arXiv 2607.05291.
Papers and sources
Reading guide
Classics: Yule (1927); Kalman (1960); Box and Jenkins (1970); Granger and Newbold (1974); Ljung and Box (1978); Dickey and Fuller (1979); Engle (1982); Bollerslev (1986, 1987); Phillips (1986); Engle and Granger (1987); Engle, Lilien and Robins (1987); Hamilton (1989); Nelson (1990, 1991); Johansen (1991); Bollerslev and Wooldridge (1992); Hall, Anderson and Granger (1992); Glosten, Jagannathan and Runkle (1993); Engle and Ng (1993); Murray (1994), "A drunk and her dog: an illustration of cointegration and error correction", The American Statistician 48(1):37–39; Harvey, Ruiz and Shephard (1994); Diebold and Mariano (1995); J.P. Morgan/Reuters, RiskMetrics Technical Document (4th ed., 1996). Realized volatility: Andersen, Bollerslev, Diebold and Labys (2000, 2003); Barndorff-Nielsen and Shephard (2002, 2004, 2006); Zhang, Mykland and Aït-Sahalia (2005); Andersen, Bollerslev and Diebold (2007); Bandi and Russell (2008); Barndorff-Nielsen, Hansen, Lunde and Shephard (2008); Corsi (2009). Evaluation: Mincer and Zarnowitz (1969); Hansen and Lunde (2005); Patton (2011); Hansen, Lunde and Nason (2011); Bollerslev, Patton and Quaedvlieg (2016). Roughness: Gatheral, Jaisson and Rosenbaum (2018). Industry: Moskowitz, Ooi and Pedersen (2012), JFE (40% ex-ante volatility per position, 60-day centre of mass, verified in the paper); Moreira and Muir (2017); Harvey, Hoyle, Korgaonkar, Rattray, Sargaison and Van Hemert (2018), JPM; Bollerslev, Hood, Huss and Pedersen (2018), RFS; Carr and Wu (2009); Christensen and Prabhala (1998); MSCI, "Market Factor: Not Just For Show" (Dec. 2011). Frontier: Zhang, Zhang, Cucuringu and Qian (2022); Reisenhofer, Bayer and Hautsch (2022); Christensen, Siggaard and Veliyev (2023), JFEc 21(5); Ansari et al. (2024, Chronos; 2025, Chronos-2); Das et al. (2024, TimesFM); Woo et al. (2024, Moirai); Ekambaram et al. (2024, TTM); Goel, Pasricha, Magris and Kanniainen (2025); Rahimikia, Ni and Wang (2025); Shi et al. (2025, Kronos); Brini (2026), arXiv 2607.05291.
For the researcher
- The theorems. Diebold and Mariano (1995); West (1996) on parameter estimation error; Clark and McCracken (2001) and McCracken (2007) for nested-model limits; Clark and West (2006, 2007); Giacomini and White (2006) for conditional predictive ability; Hansen, Lunde and Nason (2011).
- Simplifications. The simulations use squared loss and one extra regressor; CW is approximately, not exactly, normal (it is mildly undersized here, 2.9%).
- Open problems. Joint inference over many nested and non-nested models; method against model; non-quadratic losses.
Textbook audit
| Book / section | Chapter |
|---|---|
| Tsay, Analysis of Financial Time Series (3e) ch. 1 (stylized facts) | Hook, 1 |
| Tsay ch. 2 (ACF, AR/MA/ARMA, Ljung–Box, unit roots; long memory) | 1, 2; long memory in 10 |
| Tsay ch. 3 (ARCH, GARCH, IGARCH, GARCH-M, EGARCH, TGARCH, SV) | 6, 7; SV in 5; GARCH-M named in 7 (Part 23) |
| Tsay ch. 4 (nonlinear: TAR, STAR, Markov switching, neural networks) | 4; networks in 13; TAR/STAR → Part 27 |
| Tsay ch. 5 (high-frequency: bid–ask bounce, nonsynchronous trading, durations) | 9; durations → Part 36 |
| Tsay ch. 7 (extreme values, VaR) | → Part 40 (said in 16) |
| Tsay ch. 8 (VAR, cointegration, ECM, pairs) | 3; pairs → Part 33 |
| Tsay ch. 10 (multivariate volatility: EWMA, BEKK, DCC) | 8 |
| Tsay ch. 11 (state space, Kalman filter and smoother) | 5 |
| Tsay ch. 12 (MCMC for SV) | named in 5 (QML used); Bayesian methods → Part 6 |
| Hamilton, Time Series Analysis, ch. 3–5 (ARMA, forecasting, MLE) | 1, 6 |
| Hamilton ch. 6 (spectral analysis) | named in 1 (same information in frequency); not used |
| Hamilton ch. 10–11 (VARs) | 3 (VECM); impulse responses → Part 32 |
| Hamilton ch. 13 (Kalman filter) | 5 |
| Hamilton ch. 15–17 (unit roots, functional CLT, DF asymptotics) | 2 |
| Hamilton ch. 18–20 (multivariate unit roots, cointegration, Johansen FIML) | 3 |
| Hamilton ch. 21 (ARCH/GARCH) | 6, 7 |
| Hamilton ch. 22 (regime switching) | 4 |
| Brockwell–Davis, Introduction to Time Series and Forecasting (stationarity, ARMA, forecasting; ARIMA; GARCH/SV; state space) | 1, 2, 6, 5 |
| Francq–Zakoian, GARCH Models (stationarity; EGARCH/GJR; QMLE; multivariate GARCH) | 7, 8 |
| Aït-Sahalia–Jacod, High-Frequency Financial Econometrics (IV without noise and its CLT; noise; jump tests) | 9, 10; spot volatility and irregular sampling named in 9; activity index → Part 13 |
| Andersen, Bollerslev, Christoffersen and Diebold (2006), "Volatility and correlation forecasting", Handbook of Economic Forecasting | 6–12, 17 |
| Campbell–Lo–MacKinlay ch. 12 (changing volatility, ANNs, data snooping) | 6, 13, 12 |
| McNeil–Frey–Embrechts, QRM, financial time series (stylized facts, GARCH, EWMA; filtered historical simulation) | Hook, 6, 17; FHS → Part 40 |
Data, scope and reproducibilityData and reproducibility
- Binance (data.binance.vision): BTCUSDT one-minute and daily spot candles, August 2017 to December 2020, and the
USD-M perpetual's daily closes for 2020. Every downloaded file is checksummed in
../data/manifest.json. - Kenneth French's daily market and size-decile returns and monthly factors, 1926–2020; FRED DTB3, DGS5, DGS10 and VIXCLS. The hold-out from 2021 is sealed.
- Recorded in the trial registry (the 2020 comparison includes retrospective additions): the forecasting race (8 models; log-HAR added after the first results and counted), HARNet (1) and the toy foundation model (2: a PyTorch version registered first and never scored, then the numpy version that was).
- Facts checked for this expansion: Murray (1994) is The American Statistician 48(1):37–39 (Crossref); Moskowitz, Ooi and Pedersen's 40% target and 60-day centre of mass (the JFE paper's text); MSCI's descriptions of USE4's half-lives and volatility regime adjustment (MSCI, Dec. 2011). Dropped as unverifiable here: the exact USE4 regime-adjustment formula and half-lives (our replica is labeled as ours), and the Basel 1996 amendment's √10 text (the BIS document could not be retrieved; the chapter states only the mathematics).
Data, scope and reproducibilityInterpretation and scope
The registered computations, data checksums and experiment history are preserved. The as-of-Part-7 trial count is 307 (296 through Part 6 plus eleven here); later parts' registrations are excluded. No 2021-onward holdout was opened. The 2020 comparison is exploratory because results informed later additions. Networks use June training/H2 validation; classical baselines fit all 2019. HARNet's initial log-HAR fit therefore differs from the displayed race baseline.
DCC's exact multi-step Q recursion includes a EₜRₜ₊ₕ₋₁ term because standardized shock covariance is R, not Q. The a+b half-life is a linearized persistence summary, not an exact normalized-correlation forecast identity. The displayed parameter count excludes the correlation target entries. Annual covariance ellipses are one-SD return contours. The 60/40 comparison fixes realized marginal volatilities and changes correlation retrospectively.
GARCH long-run variance assumes positive omega, nonnegative alpha/beta, sum below one and conditional unit shock variance. Its squared-return ARMA identity is algebraic; a covariance-ARMA interpretation needs finite fourth moments. Strict Jensen for IGARCH needs positive alpha and nonconstant squared shocks. QMLE consistency and asymptotic normal sandwich errors require distinct regularity and moment assumptions. In SV, exp(mu/2) is stationary median volatility; mean volatility also includes exp(Var(h)/8), and RMS volatility exp(Var(h)/4).
Realized-variance CLTs and jump tests need their noise/continuity/regularity assumptions. Non-detection does not establish no jumps. The sampling-rate calculation is a two-term MSE illustration with a noise-dominance proxy; it is not a validated optimum. TSRV includes the finite-sample divisor 1−nbar/n. Rough scaling measured on an RV proxy does not prove latent roughness; the adjacent-increment correlation is fBm-implied. QLIKE ranking robustness requires positive conditionally unbiased proxies, measurable forecasts and integrability. Normal DM and bootstrap MCS statements need their dependence, estimation and fixed-candidate-set assumptions. Non-rejection is neither equivalence nor proof of no useful signal.
Bitcoin's 5/22 observations and rolling 252 days are trading-market conventions, not calendar weeks/months/years. The House's 22-day log-HAR term forecast is a recursive plug-in approximation, not exact multi-step lognormal moments. The horizon graph shows annualized RMS from averaged conditional variances, not cumulative horizon standard deviation. Physical-measure GARCH forecasts and risk-neutral option-implied volatility differ.
Industry P&L comparisons are gross of trading/funding costs with a two-day position lag and leverage cap ten; the plain benchmark is matched to full-period volatility after the fact. Drawdown is additive cumulative simple excess-return drawdown, despite the legacy cache field name maxdd_log. The VIX gap uses a broader US-market realized proxy with an approximate horizon match and is not an identified variance risk premium. Encompassing regressions are retrospective; pre-1990 GARCH parameters do not remove full-research-sample demeaning. Overlapping outcomes use HAC errors.
Brini (2026), Table 6, reports average per-asset loss ratios. Sundial and HAR are also just below log-HAR at h=1; TTM is the only foundation model ahead at all three reported horizons. The local synthetic toy is a token-embedding MLP, not a transformer or Chronos replication. Its March-13 context already includes the March-12 crash. Its interval is nominal; realized coverage is not guaranteed. Same-sample recalibration diagnoses scale rather than validating a new forecast. Nested-comparison research must account for re-estimated common coefficients and the cross term in the exact identity e₂²−e₁²=δ²−2e₁δ. Future-innovation independence alone is insufficient to discard that cross term.
Chapter notesChapters (about 60 minutes)
- The river under the noise. A century of the US market's daily moves, clusters lighting up (1929–33, 1987, 2008, 2020); pause and predict: sign or size? The autocorrelation of returns is 0.05 at lag 1 with small linear correlations thereafter; of absolute returns 0.31 at lag 1, still 0.14 at lag 100 and 0.12 at lag 250 (24,896 days). Bitcoin's river drawn live by a Kalman filter. History: Yule 1927, Kalman 1960, Box–Jenkins 1970, Dickey–Fuller 1979, Engle 1982, Bollerslev 1986, Engle–Granger 1987, Hamilton 1989, RiskMetrics 1994, the 2003 Nobel, Corsi 2009, roughness 2018, foundation models 2024. Objectives; the House.
- 1. Stationarity, ARMA and Box–Jenkins. An AR(1) on a slider (φ = 0 → 0.99) with its ACF and variance; weak
stationarity; the derivation (MA(∞) form, variance, ACF, forecast and half-life, Ljung–Box); Wold; ACF/PACF
fingerprints; the identify–estimate–check loop. Lab:
ar_fiton log VIX 1990–2020 (7,810 days): φ = 0.982, half-life 39 days; AIC picks ARMA(2,1), whose residuals still fail Ljung–Box (Q₂₀ = 43): residual serial dependence within the tested candidate set, not proof of long memory. Ljung–Box on 94 years of returns: Q = 179; on squared returns Q = 14,593. - 2. Unit roots and spurious regression. Sixty stationary paths in a band against sixty random walks in a √t
funnel. 20,000 simulated Dickey–Fuller t-statistics stream into a histogram left of N(0,1): mean −1.54, 46% below
−1.645, 5% point −2.89. The limit derived (telescoping, Donsker and demeaning for the fitted-constant specification).
Lab:
adf(5 lags): Bitcoin's log price t = −0.93, the US log index 0.64, the 10-year yield −1.03 (non-rejection, not proof of a unit root), log VIX −6.48 (rejects). Granger–Newbold: 89% false rejections in levels, 5% in differences, median R² 0.17; Phillips (1986): median |t| grows from 3.0 at T = 50 to 20.1 at T = 2,000. Bitcoin on the US market: t = 24 in levels, 6.7 in changes. - 3. Cointegration. Murray's (1994) drunk and her dog, simulated: ADF −0.95 on her position, −11.5 on the gap. Bitcoin spot and perpetual, 2020: ADF 0.96 and 0.94; Engle–Granger t = −7.2 (5%: −3.34); the basis is AR(1) with ρ = 0.55, half-life 1.2 days. ECM, Granger representation, the EG critical value, the VECM and Johansen's trace statistic derived. 3D: daily 3-month, 5-year and 10-year yields 1990–2020 as a cloud seen edge-on: principal axes 95.2%, 4.7% and 0.15% of the variance; trace statistics 68.0, 8.0, 2.0 against 29.8, 15.5, 3.8: rank 1, two common trends, the leash a curvature-like combination (−0.36, 1, −0.74).
- 4. Hidden regimes. Hamilton's filter as two jars of belief, predicted and updated month by month through 1929, then over the century; the filter, durations and stationary share derived. EM replay: most log-likelihood gain occurs early, with convergence continuing to a local solution. Calm +12%/13%/55 months, storm −15%/36%/10 months, 16% of the time in the storm. Pause: one −8% month moves the storm probability from 0.02 to 0.09.
- 5. The Kalman filter and stochastic volatility. The belief bell: predict (widen), observe, update (product of
bells, gain K). Derivation by completing the square; the steady-state gain K(q/r); Bitcoin q/r = 0.38, K = 0.45.
Lab:
kalman_states, the river redrawn with its band. Stochastic volatility by QML (Harvey–Ruiz–Shephard 1994) on 94 years: φ = 0.992, σ_η = 0.125, half-life 88 days; correlation with GARCH volatility 0.88. - 6. ARCH and GARCH by maximum likelihood. Engle 1982; the leaky bucket (tap ω, leak 1 − β, splash αr²) simulated
with US parameters; the long-run level, the EWMA unrolling, the likelihood, the term structure, GARCH as ARMA(1,1)
for r², derived. Lab:
garch_filterand its likelihood: α = 0.105, β = 0.884, log L 84,088, half-life 63 days. 3D replay: the variance-targeted likelihood surface over α and the persistence α + β (0.84 to 0.999, all stationary), a simplex search racing up the persistence slope and crawling across α in 66 iterations to (0.104, 0.884); coordinate slopes differ; precision requires a covariance calculation; EWMA at the far edge α + β = 1. - 7. The GARCH zoo. The (α, β) plane: the covariance-stationary triangle and Nelson's (1990) strict-stationarity boundary beyond it; pause: α + β = 1.05 both times, E ln(αz² + β) = −0.0074 (0.30, 0.75: stationary) and +0.0084 (0.25, 0.80: explosive). Derived: the unrolled product, the LLN argument, strict Jensen (nondegenerate IGARCH can be strictly stationary with infinite variance), the QMLE score. News-impact curves morph GARCH → GJR (a fall raises variance 4× a rise; log L 84,336) → EGARCH (84,342); Bitcoin γ = 0.14. Fat tails: GARCH residuals' kurtosis 7.8; Student-t ν = 5.6, log L +911.
- 8. Correlations that move. One stock–bond covariance ellipse per year 1962–2020, breathing and tilting, with a correlation dial. VEC 51 million, BEKK 25,050, DCC 302 parameters for 100 assets; the DCC recursion and two-step likelihood; a = 0.027, b = 0.969; EWMA overlay. Pause: a 60/40 model assuming ρ = +0.3 in 2010 said 12.5%; the correlation was −0.49 and the portfolio's volatility 9.9%.
- 9. Realized volatility. One wild Bitcoin day (26 June 2019) cut into squares at 30, 10, 5 and 1 minutes. The signature plot built point by point: in 2019, 1-minute RV reads 1.6% more than 5-minute; over the whole sample, 10%. Derived: RV → IV, the BNS CLT, the noise bias 2nη², Bandi–Russell's n* (median Δ* ≈ 9 minutes), TSRV, realized kernel. Averages: 106% (1-min), 96% (5-min), 93% (TSRV and kernel), 92% (bipower); the daily CLT band.
- 10. Jumps and HAR. Squares against bipower rectangles; the BNS (2006) ratio test: 27% of days jump at 1%, 16%
at 0.1%; 12 March 2020 has z = 0.05: no jump detected by this nominal test, not proof of no jump. HAR as an AR(22) staircase against GARCH's geometric
weights; the ACF of log RV against the simulated log-HAR and an AR(1). Lab:
har_fit: b_d 0.41, b_w 0.03, b_m 0.43, R² 0.38; the rolling-252-observation replay (about eight Bitcoin months) (the week and month trade places). HARQ attenuation derived; b_q = −3.0 (t −0.7); HAR-CJ jump coefficient 1.50; log-HAR. - 11. Is volatility rough? fBm with H = 0.1 and 0.5, zoomed twice. Lab:
log_rv_scalingrecovers H = 0.11 and 0.50 on simulated paths; Bitcoin's log RV gives H = 0.13. The RFSV predictor's power-law kernel; HAR as its cheap approximation; Part 14 builds the models. - 12. Scoring forecasts honestly. Hansen–Lunde. Expected-loss curves as the proxy gets noisier: QLIKE's minimum
stays at the truth, MSE on volatility slides to 0.64 (Patton 2011, proved). Simulation (200 runs × 2,500 days):
QLIKE and MSE on variance pick the truth under every proxy; MSE and MAE on volatility pick 0.8 × truth against
squared returns. Lab:
qlike,diebold_mariano; Mincer–Zarnowitz slopes (HAR 0.98, log-HAR 1.35). The model confidence set (Hansen–Lunde–Nason 2011): at 90% all nine survive; at 75% EWMA, HAR and GARCH drop out. - 13. Training the networks. LSTM, transformer and HARNet (Reisenhofer–Bayer–Hautsch 2022, initialised at log-HAR): 1,233, 2,625 and 111 parameters. Training replays with five-seed bands and the validation forecasts at epochs 0, 5, 10, 20, 40 and best; seed spreads (LSTM 0.366–0.378, transformer 0.401–0.433, HARNet 0.359–0.362); HARNet starts at validation loss 0.272 and ends at 0.270.
- 14. The race. Networks train to June 2019 and validate H2; classical fits use all of 2019. The reused 2020 comparison is retrospective. A live leaderboard: EWMA leads until 11 March, 12 March reshuffles everything. QLIKE: HARNet 0.360, log-HAR 0.363, LSTM 0.371, transformer 0.410, HARQ 0.426, HAR 0.427, GJR 0.444, GARCH 0.452, EWMA 0.512; DM t against log-HAR: HARNet −0.99, LSTM +1.46. On MSE, GJR first. The 2020 overlay.
- 15. Foundation models and the frontier. Chronos's tokenisation drawn; a toy Chronos-style model trained here on 3,000 synthetic volatility series (128 bins, context 64, a 42,176-parameter numpy network, 3 seeds, replayed) and run zero-shot on Bitcoin 2020: QLIKE 0.416 against log-HAR's 0.363 (DM t = +1.7, within noise; between HAR and the transformer), its 10–90% fan covering 85% of days. Brini (2026), Table 6, h = 1, as published: TTM 0.982, HAR 0.998, Sundial 0.998, log-HAR 1.000, ARMA 1.000, Moirai-2.0-S 1.038, TimesFM-2.5 1.086, Moirai-MoE-S 1.090, Chronos-Bolt-S 1.110, Chronos-Bolt-B 1.121, Toto 1.214, Lag-Llama 1.532. The 2022–2026 papers.
- 16. March 2020. The crisis file; every model's forecast for 12 March (62–76%) against 457%; the weeks around it; √T against GARCH's term structure (85% next day, 52% over a year, 18% long run).
- 17. Industry. RiskMetrics (λ = 0.94 daily, 0.97 monthly; MSCI's 2010 acquisition): our λ grid on the US market 1990–2020, RMSE best at the grid edge 0.85, QLIKE at 0.94. Barra USE4's longer correlation half-life and volatility regime adjustment (MSCI's words); our replica on ten size deciles peaks at 2.1 (1929–33), 2.7 (1987), 2.2 (2020); QLIKE 1.70 → 1.66. Volatility targeting (Harvey et al. 2018; MOP 2012's 40% target and 60-day centre of mass): on the US market 1927–2020 at 10%, Sharpe 0.44 → 0.58, worst-1% mean −2.78% → −2.55%, maximum drawdown of additive cumulative simple excess returns 1.04 → 0.67. The VIX above next-month realized on 85% of days (by 4.1 points); R² 0.52 (VIX), 0.50 (GARCH); both significant together (t 7.2 and 3.2).
- 18. The volatility forecaster. The module table; Rule 8; eleven models registered in this part, the series' trial
counter at 307. Lab:
forecaston 31 Dec 2020: Bitcoin 91% tomorrow, 84% over 22 days; the US term structure 9.1% (1 day) → 15.3% (1 year), long run 17.6%. - For the researcher: comparing nested forecasts. Why Diebold–Mariano fails when one model nests another (the population differential is zero; estimation noise makes \(E[\bar d] < 0\); Clark and McCracken's non-standard limit), and Clark and West's (2007) adjusted MSPE. Simulation (2,000 runs, \(R\) = 100, \(P\) = 200, a persistent regressor): with the null true DM rejects 0.4% at a nominal 5% (mean −0.84), CW 2.9% (−0.35); power at a slope of 0.05: 1.0% against 8.0%; at 0.1: 3.6% against 25.4%. Bitcoin's RV, recursive 2019–2020: HAR over one lag MSE ratio 1.013, DM −0.23, CW 0.82; HARQ over HAR 1.654 (March 2020), both −1.05. Three open problems.
- Recap, four desk questions, eight problems (two at qualifying-exam level), payoffs, references.
中文讲义
本讲的中文说明、交易台问题与习题解答(与英文版对应)。
导言量化金融,从零搭建 — 第7部分:时间序列与波动率
收益的线性自相关较小,幅度的持续性更强;低自相关不证明不可预测。本部分是一门关于预测它的模型的课程,从尤尔的自回归一直讲到时间序列基础模型;每个模型都在屏幕上拟合或训练, 并作回顾性预测评估;2020年曾用于追加模型,另一个2021年起的保留集仍封存。实证示例由本系列代码按公开数据计算,模拟固定种子;没有运行、直接引用的结果(基础模型的比较)标注为论文数据。
讲的是方法,不构成投资建议。
Chapter notes章节(约57分钟)
开场(波动聚集、收益与绝对收益的自相关、卡尔曼河流、历史);1. 平稳性、ARMA与博克斯–詹金斯方法;2. 单位根与伪回归;3. 协整(醉汉与狗、 比特币基差、三维国债收益率的约翰森检验);4. 隐藏机制;5. 卡尔曼滤波与随机波动率;6. 用最大似然估计ARCH与GARCH(漏水桶、三维似然面); 7. GARCH家族(纳尔逊平稳性边界、新闻冲击曲线、学生t);8. 会变的相关性(DCC);9. 已实现波动率(签名图、噪声、最优采样);10. 跳跃与HAR; 11. 波动率是粗糙的吗?;12. 诚实地给预测评分(QLIKE、DM、MZ、模型置信集);13. 训练神经网络;14. 竞赛;15. 基础模型与前沿;16. 2020年3月; 17. 业界(RiskMetrics、Barra、波动率目标、VIX);18. 波动率预测器;回顾、交易台问题与习题。各章数字见上面英文部分。
Desk questions, with solutions交易台问题与解答
- 日波动率为1%。 若收益独立且方差恒定,方差可加:一周1% × √5 ≈ 2.2%,一年1% × √252 ≈ 15.9%。这个法则有三种失效方式。 第一,波动率均值回归,从高位出发,一段期限内的平均低于今天的水平(GARCH:E_t[σ²_{t+h}] = σ̄² + (α + β)^{h−1}(σ²_{t+1} − σ̄²)), 第16章中85%在一年里降到52%。第二,收益自相关时,总和的方差会乘以1 + 2Σ(1 − k/h)ρ_k(Lo–MacKinlay方差比)。第三,厚尾收益的分位数不按√T缩放, 因为厚尾收益之和比单个收益更接近正态。
- 两个价格之间t = 24。 先检验两个序列有没有单位根(ADF)。如果都有,这个t统计量没有意义(第2章:89%的错误拒绝,而且按√T增长)。 对水平回归的残差做单位根检验,用恩格尔–格兰杰临界值(两个序列时5%水平约−3.34,而不是−2.86),或者用变化量对变化量回归。
- 一个模型在包含崩盘的一年里按MSE胜过GARCH。 方差预测的平方误差由最大的几天主导,一天就可能决定胜负。应当用QLIKE评分, 它对已实现代理变量中的噪声稳健(Patton 2011);对比HAR而不是弱基准;用带HAC方差的Diebold–Mariano检验和模型置信集;并检查去掉危机几周后排名是否依然成立。
- GARCH拟合得到α + β = 1。过程平稳吗? 不是协方差平稳的:无条件方差ω/(1 − α − β)为无穷。但它是严平稳的:展开得 σ_t² = ω Σ_k Π_{j≤k}(αz²_{t−j} + β),当E ln(αz² + β) < 0时收敛(Nelson 1990),而由詹森不等式E ln(αz² + β) < ln E(αz² + β) = ln(α + β) = 0。 方差预测永远不回归(RiskMetrics的EWMA就是ω = 0的这种情形)。
Problems, with worked solutions习题与解答
-
GARCH的期限结构。 对GARCH(1,1),\(\sigma^2_{t+1} = \omega + \alpha r_t^2 + \beta\sigma_t^2\),推导\(h\)步预测\(\mathbb{E}_t[\sigma^2_{t+h}] = \bar\sigma^2 + (\alpha + \beta)^{h-1}(\sigma^2_{t+1} - \bar\sigma^2)\)以及冲击的半衰期。
解答
记σ̄² = ω/(1 − α − β)。由于E_t[r²_{t+k}] = E_t[σ²_{t+k}],对σ²_{t+k+1} − σ̄² = α(r²_{t+k} − σ̄²) + β(σ²_{t+k} − σ̄²) 取期望,得E_t[σ²_{t+k+1}] − σ̄² = (α + β)(E_t[σ²_{t+k}] − σ̄²),归纳得E_t[σ²_{t+h}] = σ̄² + (α + β)^{h−1}(σ²_{t+1} − σ̄²)。 冲击在log 0.5/log(α + β)天后减半:美国市场的0.989对应63天。
-
GARCH即ARMA,及其峰度。 推导平方收益的ARMA恒等式、高斯GARCH四阶矩条件,以及四阶矩有限时的峰度。
解答
令ν_t = r_t² − σ_t²,它是鞅差。把σ_t² = r_t² − ν_t代入GARCH递推,得r_t² = ω + (α + β)r²_{t−1} + ν_t − βν_{t−1}: 自回归根为α + β的ARMA(1, 1)。正态冲击下E[r⁴] = 3E[σ⁴]。对递推式平方取期望得E[σ⁴](1 − (α + β)² − 2α²) = ω² + 2ωσ̄²(α + β), 峰度为3(1 − (α + β)²)/(1 − (α + β)² − 2α²)。只要α > 0它就大于3,且仅当(α + β)² + 2α² < 1时有限。
-
已实现方差中的噪声与最优采样频率。 在连续价格、独立同分布且外生的价格噪声下,推导\(2n\eta^2\)偏差,并最小化示意MSE式\(4n^2\eta^4+2IQ/n\)。
解答
若观测对数价格为p_i = p*_i + u_i,噪声独立同分布、方差η²,则观测收益为r_i = r*i + u_i − u{i−1}, E[Σr_i²] = ∫σ²dt + 2nη²:偏差随n增长(签名图)。无噪声时RV的估计误差方差为2IQ/n(BNS)。均方误差约为(2nη²)² + 2IQ/n = 4n²η⁴ + 2IQ/n; 令导数8nη⁴ − 2IQ/n²为零得n* = (IQ/(4η⁴))^{1/3}(Bandi与Russell 2008)。双尺度RV则消除偏差:对K个稀疏网格取平均(各自偏差2n̄η²), 再减去(n̄/n)RV_all,以n^{−1/6}的速度收敛。
-
QLIKE。 在正的条件无偏代理、可测预测及有限期望损失下,推导QLIKE目标\(\hat h=E[h\mid\mathcal F]\)与排名稳健性。
解答
E[h/ĥ − log(h/ĥ) − 1 | F] = E[h|F]/ĥ + log ĥ − E[log h | F] − 1。对ĥ的导数为−E[h|F]/ĥ² + 1/ĥ,只在ĥ = E[h|F]处为零, 且函数在那里是凸的。损失只通过E[h|F]依赖于h,另加一项与ĥ无关的量,所以无偏代理(E[h̃|F] = E[h|F])只给每个预测的期望损失加上同一个常数, 排名不变(Patton 2011)。对波动率上的MSE,argmin E(√h̃ − σ̂)² = E√h̃ < √E h̃(詹森):以平方收益为代理时,最小点是(2/π)h ≈ 0.64h。
-
卡尔曼增益。 写出局部水平模型的卡尔曼滤波,并证明其稳态增益只取决于信噪比。
解答
对x_t = x_{t−1} + w_t、y_t = x_t + v_t,方差分别为Q与R,滤波器先预测P⁻ = P + Q,用增益K = P⁻/(P⁻ + R), 再更新P = (1 − K)P⁻。稳态时KP⁻ = Q,且P⁻满足P⁻² − QP⁻ − QR = 0。除以R²并记q = Q/R,得p = P⁻/R = (q + √(q² + 4q))/2, K = p/(p + 1),只是q的函数。比特币的q = 0.38给出K ≈ 0.45。
-
带常数项的迪基–富勒极限。 随机游走拟合常数项、无趋势:用\(W_\mu=W-\int_0^1W\)与\(A=\frac12(W(1)^2-1)-W(1)\int_0^1W\)推导系数和DF \(t\)的极限。
解答
假设x₀ = 0、冲击独立同分布、均值零且方差有限。记x̄₋为滞后水平的样本均值, 则Σ(xₜ₋₁ − x̄₋)εₜ = ½(x_T² − Σεₜ²) − x̄₋x_T。令Wμ = W − ∫₀¹W、A = ½(W(1)² − 1) − W(1)∫₀¹W, 得T(ρ̂ − 1) ⇒ A/∫Wμ²,t_DF ⇒ A/√∫Wμ²。∫Wμ dW只是这个显式路径函数的简写,不是普通适应性Itô被积过程。 这与带常数、无趋势的模拟一致。无截距和带趋势的检验有不同极限与临界值。
-
(资格考试)为什么DM偏向小模型。 (资格考试)在所述嵌套模型正交近似下,推导\(\mathbb E[e_2^2-e_1^2]\approx\mathbb E[(\hat y_1-\hat y_2)^2]>0\)并解释DM的偏移。
解答
原假设下\(\hat y_2 = \hat y_1 + g\),\(g\)在冲击之前已知;\(e_2^2 - e_1^2 = g^2 - 2ge_1\),还需估计误差的正交等条件才能作一阶近似 \(E[ge_1] \approx 0\),所以\(E[e_2^2 - e_1^2] \approx E[g^2] > 0\):统计量中心低于零,而克拉克–韦斯特的\(f = e_1^2 - (e_2^2 - g^2)\)中心接近零。
-
(资格考试)偏多少。 (资格考试)在理想化的单新增回归变量设定下,推导平均预测差平方的近似式\(\sigma^2\ln(1+P/R)/P\)。
解答
一个额外回归变量时,\(E[g_t^2] \approx \sigma^2/t\);在\(t = R, \dots, R + P - 1\)上平均得约\(\sigma^2\ln(1 + P/R)/P\)。
For the researcher写给研究者
迪博尔德–马里亚诺(1995);参数估计误差(West 1996);嵌套模型极限(Clark与McCracken 2001;McCracken 2007);Clark与West(2006、2007); 条件预测能力(Giacomini与White 2006);模型置信集(Hansen、Lunde与Nason 2011)。开放问题:多个嵌套与非嵌套模型的联合推断;方法与模型之辨;非二次损失。
Textbook audit教材对照
见上面英文部分的表格:Tsay第1–5、7、8、10–12章,Hamilton第3–6、10–11、13、15–22章,Brockwell–Davis,Francq–Zakoian, Aït-Sahalia–Jacod,Andersen等(2006)手册章节,CLM第12章,QRM,均对应到本部分的章节或本系列的其他部分。
Data, scope and reproducibility解释与适用范围
原登记计算、数据校验与实验历史保留,未打开2021年起的保留集。本部分累计307次试验;2020年比较曾复用,属于探索性。 网络训练至2019年6月、下半年验证,传统基线拟合全年。DCC多步Q预测必须包含期望R项,a+b半衰期仅为线性化持续性摘要。 QMLE一致性与正态标准误有不同矩条件;IGARCH严格詹森结论需alpha为正且平方冲击非恒定。SV的exp(mu/2)是平稳中位波动率, 不是均值。RV区间和跳跃检验依赖无噪声、连续性等条件;未检出不证明没有跳跃。TSRV含1−nbar/n分母,采样最优值只是近似演示。 代理的粗糙缩放不能直接证明潜在粗糙性;QLIKE、DM、MCS须满足各自的代理、依赖、估计和固定候选集条件。 比特币5/22期不是日历周月,252日约八个月;22日递归log-HAR是插件近似。期限图展示预期方差平均后的年化均方根。 业界示例未扣成本,普通基准事后匹配波动率;回撤是累计简单超额收益的回撤。VIX与未来实现波动率的差不直接识别方差风险溢价, 回顾性涵盖回归不等于新预测验证。论文TTM的结论限于所述基准;本地玩具是词元嵌入MLP,3月13日上下文已含12日危机。 嵌套比较的delta包含共同系数重新估计,恒等式的交叉项不能只凭未来新息独立而忽略。
The screen's API table lists representative pairs; the House module contains the complete toolkit. Trial counts use the registered model/protocol units, including an abandoned foundation-model attempt. The fixed five-seed neural averages are one protocol per architecture; selecting a winning seed would create an additional selection choice. The toy's probability snapshots share fixed axes, and the DF histogram includes the tallest early Monte Carlo bars while omitting contaminated tail bins. The Kalman bells use data coordinates rather than the axes wrapper's internal range. EWMA has no fixed variance-reversion target; the bucket metaphor refers to no net expected leak.
Build the film
python -m videos.quant.quant7.compute # the part's numbers, into .cache/quant7
python tools/make.py quant7 # the narrated film, English and Chinese
EXPLAINER_TTS=silent python tools/qa_scene.py quant7 Hook # one chapter, silent, with a contact sheet
Scenes: videos/quant/quant7. Setup: see the course page. Source of these notes: the part's README and the scenes' narration.