The Analyst's Path

Phase 12Finance Plus, AI and the quant-code trackFinance trackQM1.0315,761 words1 h 28 min of readingabout 18 hours of study6 concept pagesfree

Time-Series, Monte Carlo & Intro ML-for-Finance

A deterministic trend is a fixed function of time (x_t = a + b·t + noise_t), the noise is temporary, and the series always reverts to the line a + b·t no matter what shock hits it.

Branch: Quantitative Methods (Finance-Plus Ring) · Node QM1.03 · ~18 focused hours · Standard mastery gate ≥ 85%

QM1.01 taught you to describe a single draw from a distribution. QM1.02 taught you to test whether two variables move together and to regress one on several others. Both modules quietly leaned on one assumption that this module now breaks: that your observations are independent of each other, so that order doesn't matter and yesterday tells you nothing about today beyond what the model already captures. A time series violates that assumption by definition (it is data with a memory) and almost everything distinctive about the tools below exists to handle that memory correctly instead of pretending it isn't there. Here is the whole module compressed into one sentence you will spend eighteen hours earning the right to believe: a time series's own past is informative right up until you've modeled it correctly, a simulation lets you manufacture a thousand plausible futures when history has handed you exactly one, and a model that fits your training data beautifully can still be worthless the moment it meets new data, three separate ideas that share one discipline underneath: test before you trust, and verify out of sample before you believe you've found anything at all. This Ring is additive institutional/CFA breadth, it presents the toolkit and the plumbing alongside, not in place of, the program's process-over-P&L, concentration-over-diversification philosophy.

Advertisement

Where it sits. This is the third and final node of the Quantitative Methods branch. QM1.01 gave you the probability engine (distributions, sampling, the CLT, estimation); QM1.02 gave you inference and regression (hypothesis tests, simple and multiple regression, the diagnostics that catch a lying regression). This module assumes both, you should already be fluent in OLS mechanics, R², t-stats, and p-values before you start, because every technique below either extends OLS into a new setting (an AR model is an OLS regression, just of a series on its own lagged self) or exists precisely to warn you when OLS's ordinary assumptions have quietly failed. New here: processes with memory (AR/MA/ARMA), the specific failure mode of non-stationary data (the unit root, and the spurious regressions it produces if you ignore it), the long-run-equilibrium exception to that failure mode (cointegration), Monte Carlo simulation as a general-purpose tool for turning "I don't know the exact answer" into "I know the distribution of plausible answers," and the vocabulary and failure modes of machine learning as they apply to finance. On every one of the last three topics, this module's job is to teach you to think correctly and compute the numbers by hand or in a short script, never to build the production system. Building that system, at scale, with hidden tests and real datasets, belongs to a different region of this program entirely, and this module tells you exactly where every single time.

App link. The app's Time-Series & Monte-Carlo Lab is this node's applied gate: it hands you a fresh synthetic return series (India- or US-flavored, your choice) and a small multi-asset book, asks you to identify the process from its ACF/PACF, run the stationarity test, and build a Monte Carlo VaR, then re-grades your fitted coefficients, your stationarity call, and your VaR estimate against tolerance bands, exactly the way the rest of the corpus's labs work. The gate for this node is the mastery check below (≥85%) combined with that simulation lab passing its hidden checks, the mini-project later in this document is your rehearsal for exactly that lab.


Learning objectives

By the end you can:

  1. Explain, in mechanism, why time-ordered data breaks the independence assumption behind ordinary statistics, and define the autocorrelation function (ACF) and partial autocorrelation function (PACF) that measure exactly how much memory a series carries.
  2. Write down an AR(1) and an MA(1) process from first principles, state their stationarity/invertibility conditions, derive each one's theoretical ACF/PACF signature, and use the Box-Jenkins identification grid to tell an AR process from an MA process by eye.
  3. Fit an AR(1) and an MA(1) to a real (synthetic, India ₹ and US $) return series in Python, reading off the fitted coefficient, its standard error and significance, the implied half-life of a shock, and the model's R², and interpret every number correctly.
  4. Define stationarity precisely, explain why a random walk is the canonical non-stationary process, and run and correctly interpret an Augmented Dickey-Fuller test, including why its critical values are not the ordinary t-table.
  5. Explain, and demonstrate numerically, why regressing one non-stationary series on another produces a spurious regression (high R², significant-looking t-stats, near-zero Durbin-Watson) with no real relationship behind it, and state the cointegration exception: when two non-stationary series share a genuine stable long-run relationship, and how the Engle-Granger two-step test detects it correctly (including why the test needs its own, stricter critical values).
  6. Build a Monte Carlo simulation from scratch, specify a data-generating process, draw correlated random variates via a Cholesky decomposition, simulate paths, and compute a distribution of outcomes, and compute a Monte Carlo Value-at-Risk and Expected Shortfall on a two-asset India/US book, cross-checked against a closed-form parametric estimate.
  7. State the Monte Carlo standard-error law (∝ 1⁄√N), explain why 10× more simulations buys only ≈3.16× more precision, and correctly judge when a variance-reduction technique (antithetic variates) helps a lot versus only a little.
  8. Frame supervised versus unsupervised learning correctly, state the train/validation/test discipline and k-fold cross-validation, define overfitting as a bias-variance tradeoff and demonstrate it numerically on a fitted-polynomial example, and name the finance-specific trap (look-ahead bias from a non-chronological split) that breaks all of the above in a time-series setting.
  9. (Productivity objective: R10 duality, the QM/AA angle: copilot-but-you-interpret.) Use an AI assistant to accelerate order-selection, scenario narration, and concept-tutoring on this module's tasks, while never letting the tool's suggestion replace your own diagnostic read of the ACF/PACF, the test statistic, or the convergence table.
  10. State the binding C-3 boundary from memory: this module teaches the concepts, the math, and the failure modes; the quant-code region (DA/QD) teaches every one of these ideas in code (implementation, validation, pipelines, evaluation) and you can name exactly which module to go to for each build.

The duality, stated once (R10). Every module in this Ring carries two objectives at once. The understanding objective (items 1–8 and 10) is what the mastery gate rewards. The productivity objective (item 9) is the payoff you keep: knowing how to let a copilot draft the order-selection narrative or the scenario write-up while you remain the one who reads the diagnostic. A tool can suggest an ARIMA order; only you can look at the ACF and PACF and decide whether that suggestion is defensible.


Prerequisites & connections

Builds on. QM1.01 (probability, distributions, the CLT, and point/interval estimation, the Monte Carlo section below is the law of large numbers put to work, and its standard-error arithmetic is a direct descendant of QM1.01's sampling-distribution machinery) and QM1.02 (hypothesis testing and regression, every AR/MA fit below is an OLS or maximum-likelihood regression, and the diagnostic instincts QM1.02 built (read the standard error, read the t-stat, don't trust R² alone) are exactly what catches a spurious regression here). EX2.03 (Financial & Statistical Functions) already taught you LINEST, FORECAST.LINEAR/TREND, CORREL/RSQ, and the four ways an Excel regression lies (causation, small samples, non-stationarity, extrapolation), this module is the inferential/econometric layer under that Excel skill: EX2.03 told you non-stationarity was one of four traps; this module gives you the actual test that catches it and the actual math that explains why it's a trap. Nothing here re-derives LINEST. M2.07 (Shenanigans II & Quantitative Screens) used the Beneish M-Score, the Sloan accruals ratio, Altman's Z, and the Piotroski F-Score, every one of them a statistically estimated model built on the same sampling and estimation logic QM1.01/1.02 supplied; this module doesn't re-teach those screens, but it is worth noticing in passing that Altman's Z-score is literally a linear discriminant classifier, an early, hand-built cousin of the supervised-learning classifiers framed in §9 below.

Feeds forward, and hands off (the binding C-3 boundary). This is the module's single most important connection, so it is stated here and repeated at the end of Core teaching content. QM (this branch) teaches statistics and machine-learning concepts, the intuition, the math, and the failure modes. The quant-code region teaches every one of them in code (implementation, validation, pipelines, and evaluation) and no worked content is duplicated between the two. Concretely: DA1.05 (Statistics in Code) is where the AR/MA/ADF work above gets run at scale in statsmodels; DA2.03 (Deep Learning, NLP & Time-Series Forecasting) is where a real ARIMA/SARIMA/Prophet-class forecasting pipeline gets built, validated, and graded; DA2.01 (Machine Learning I. Supervised Learning) and DA2.02 (Machine Learning II. Unsupervised, Feature Engineering & Model Discipline) are where §9's supervised/unsupervised framing becomes a real scikit-learn pipeline with leak-free cross-validation; QD1.02 (Signal & Factor Construction and Evaluation) and QD1.03 (Building a Backtesting Engine, with its no_lookahead harness) are where the look-ahead-bias warning in §9 becomes an automated guard a strategy must pass; QD2.02 (Risk Systems in Code. VaR, Expected Shortfall, Stress & Scenario) is where §8's Monte Carlo VaR becomes a production risk engine, backtested against realized outcomes. This module also feeds AA1.01 (MVO and the efficient frontier need the covariance/correlation estimation this module and QM1.01/1.02 supply), FI1.03 (a short-rate model is a stochastic process, and this module is where you first met one), and DV1.02 (risk-neutral valuation is, at heart, an expectation, the exact object Monte Carlo is built to estimate).

Two siblings inside the branch own material this module deliberately stops short of. QM1.05 owns the ARCH and GARCH family, so the volatility clustering visible in every return series here is modelled there rather than in these sections; it also owns deterministic trend models fitted as regressions, and it carries the machine-learning half beyond the concepts sketched in §9. QM1.04 owns multiple testing, which is what governs how many lags, specifications or strategies you may scan before a p-value or a two-over-root-T band stops meaning what it says. Cite both rather than rebuilding them here.

The one-sentence version of this module. A time series has a memory that ordinary statistics ignores at its peril, model that memory with AR/MA, test whether it's even stationary before you trust any of it, use a Monte Carlo simulation whenever you need a distribution of futures rather than a single point forecast, and never let a model's beautiful fit to yesterday's data fool you about how it will do tomorrow, then hand every one of those builds to the quant-code region, because this branch's job stops at understanding.


Core teaching content

Why time matters: the memory that ordinary statistics ignores

QM1.01 and QM1.02 built every tool (the sampling distribution, the t-test, the OLS regression) on an assumption so basic it rarely got a name: your observations are independently and identically distributed (i.i.d.). Draw ten companies' current ROE and the order you wrote them down in tells you nothing; shuffle the list and every statistic is identical. A time series destroys that assumption on purpose: today's return, this month's inflation print, each is measured in a specific order, and that order is not decoration. If today's high volatility tends to be followed by tomorrow's, the data has a memory, and any tool that assumes independence will misstate your uncertainty, sometimes by an order of magnitude.

The formal object that measures memory is the autocorrelation function (ACF). For a time series x_t, define the autocovariance at lag k as γ(k) = Cov(x_t, x_{t-k}) and the autocorrelation as ρ(k) = γ(k)/γ(0), the correlation of the series with itself, k periods back. ρ(0) = 1 always; ρ(1) tells you how much of today survives into tomorrow; ρ(5) tells you how much survives five periods out. Plotted against k, the ACF is called a correlogram, and reading its shape is the single most diagnostic habit in this module. Its close cousin, the partial autocorrelation function (PACF), measures the correlation between x_t and x_{t-k} after stripping out the influence of everything in between (lags 1 through k-1), the direct link, not the link mediated by the intervening periods. The two together are how you will identify almost every process below without fitting a single parameter first.

Trend, seasonality, and the decomposition trap

The oldest, most intuitive way to describe a time series is a decomposition: x_t = Trend_t + Seasonal_t + Residual_t (additive) or the multiplicative analogue when the seasonal swing scales with the level. A retailer's monthly revenue has an obvious seasonal component (a December spike); a growing economy's GDP has an obvious trend component. Decomposition is a legitimate, useful description, and it hides a trap this module exists to expose: there are two structurally different kinds of "trend," and mistaking one for the other is the single most common time-series error a numerate analyst makes.

A deterministic trend is a fixed function of time (x_t = a + b·t + noise_t), the noise is temporary, and the series always reverts to the line a + b·t no matter what shock hits it. A stochastic trend is entirely different: it arises when shocks accumulate permanently, so the series' own past values, not calendar time, define where it sits, a random walk. The two can produce charts that look identical over any finite sample, yet call for opposite treatment: safely detrend and forecast the first; naively detrend the second and you manufacture a nonsense forecast, because there is no fixed line for it to revert to. §"Stationarity and the unit root" builds the formal test that tells them apart. Worked Example 3 is built specifically to fool your eye with this exact trap.

Autoregressive model

An autoregressive (AR) model explains each value of a series from its own earlier values. In an AR(1), today's value is a constant plus a fixed multiple of yesterday's value, with a random shock on top. Analysts use the multiple to work out how long a shock takes to fade, and they check the residuals for any pattern, such as seasonality, that the fit has missed.

6 min read, on its own page

ARIMA model

An ARIMA model, written ARIMA(p,d,q), describes a series by differencing it d times until it is stationary, then fitting p autoregressive lags and q moving-average lags to what is left. Differencing matters because most asset-price levels need one difference to become stationary, while returns usually need none. Analysts pick p and q from the shape of the correlogram, helped by information criteria such as AIC and BIC.

5 min read, on its own page

Cointegration

Cointegration is when two or more series that each wander on their own stay tied together over the long run, so that a weighted spread between them is anchored and keeps reverting to its mean. It is the formal version of a long-run equilibrium, such as two public sector bank shares that drift together on a common banking trend. Analysts test for it with the Engle-Granger two-step test, because regressing two unrelated random walks on each other can show a high R² and a tiny p-value with no real relationship.

3 min read, on its own page

Monte Carlo simulation

Running a model thousands of times with inputs drawn at random from chosen distributions, to see the spread of possible outcomes rather than a single answer. It suits problems where several uncertain inputs interact and no formula gives the distribution directly. Its output is only as good as the input ranges and, above all, the correlations between them: growth and margins drawn independently when they really rise and fall together produce a distribution that looks far tighter than it should.

6 min read, on its own page

Machine learning in finance

Machine learning in finance means using models that learn from data: some predict an outcome, such as a bond's yield or default versus no default, and others find structure, such as groups of similar stocks. The main risk is overfitting: a flexible model can fit its training data perfectly and still be useless on anything new. The fix is to judge every model on data it hasn't seen, and for time series only on data that comes later in time.

7 min read, on its own page

Common mistakes & how experts think differently

  1. "The price has been climbing steadily for three years, that's clearly a trend, so I'll fit a line and extrapolate it." Worked Example 3's price series climbs from $100 to $169.89 over three years and is, by construction, a pure random walk with drift, no deterministic trend anywhere in its DNA. The expert's first move on any trending chart is to ask whether the trend is deterministic or stochastic, and to run the ADF test rather than trust the eyeball, because the two can be visually indistinguishable over any finite sample.
  2. "These two series have an R² of 0.60 and a wildly significant t-statistic, they must be related." Worked Example 5 delivers exactly that R² and a t-statistic of 17.6 (p ≈ 10⁻⁴³) from two series with zero true relationship, because both are independent random walks. The expert's reflex on seeing a strong-looking regression between two levels series is to check the Durbin-Watson statistic (near zero is the classic spurious-regression tell) and to test the residual for a unit root before believing the headline R².
  3. "The ADF test failed to reject the unit root, so I've proven the series has a unit root." Failing to reject a null hypothesis is never proof of that null, it only means the data didn't supply enough evidence against it. The expert reports "failed to reject H₀ at the 5% level" and stops there, exactly as with any other hypothesis test in QM1.02.
  4. "I ran the residual from my cointegration regression through a standard Dickey-Fuller test and got a great p-value." The residual from an estimated regression is not raw data, estimation shifts the test statistic's null distribution, and the plain ADF table systematically overstates significance. Worked Example 4: a naive read gives p ≈ 0.009 (looks overwhelming); the correctly-adjusted Engle-Granger test on the identical data gives p ≈ 0.035, still significant, but nowhere near as comfortably. The expert always reaches for the dedicated cointegration test, never the plain unit-root table, on a regression residual.
  5. "I grid-searched fifty ARIMA orders by AIC and used the lowest score: done." An in-sample-only information criterion can still lead you to overfit the specific noise in your sample. The expert treats the AIC-minimizing order as a candidate, checked against an out-of-sample holdout or a rolling evaluation before trusting it, the same discipline §9 builds for any ML model.
  6. "I shuffled my time-series rows before the train/test split, the way I would for cross-sectional data." Pure look-ahead bias: the model learned from data that, in real time, came after the period it is predicting. The expert splits chronologically, never by a random shuffle, and reaches for a walk-forward scheme when a single split isn't enough.
  7. "Our pairs-trade cointegration relationship has held for five years, so it's structural and safe to lever." Cointegration is an empirical, time-bounded finding, not a law of physics, a merger, a regime shift, or a business-mix change can break a genuine long-run relationship overnight. The expert re-tests periodically and treats "it held historically" as evidence, never a guarantee.
  8. "I ran the Monte Carlo once at N = 1,000 and reported the VaR to the rupee." A single small-N run carries real sampling noise. Worked Example 6's convergence table puts the standard error of a VaR₉₅ estimate at N=1,000 near ₹19,600, nearly five times the N=100,000 figure's ≈₹1,700. The expert checks the estimate's stability across repeated runs or rising N before treating any Monte Carlo output as precise rather than an estimate with its own uncertainty.
  9. "The model is 92% accurate on predicting a market downturn day: ship it." If downturn days are only 5% of all days, a model that never once predicts a downturn is already ~95% "accurate" while being completely useless. The expert always checks accuracy against the relevant base rate (and reaches for precision/recall or AUC on an imbalanced target) before treating a bare accuracy number as meaningful.
  10. "I kept trying different model choices against the test set until the test-set number looked good." The moment you tune anything based on test-set performance, the test set has become a second training set, and its number no longer estimates true out-of-sample skill. The expert touches the test set exactly once, uses cross-validation inside the training data for every tuning decision, and treats a test set that has been "peeked at" as contaminated.

The thread through all ten: the expert never mistakes a good-looking fit, a significant-looking t-stat, or a single simulation run for the real thing it is trying to estimate (memory, a genuine relationship, or a true expectation) until an out-of-sample check, an adjusted test, or a repeated run has confirmed it.


Worked examples

All entities below are explicitly synthetic (R3); every figure was computed in Python during authoring (seeds given so you can reproduce every number exactly) and no real company's or index's actual data is represented.

Worked example 1: Fitting AR(1) to a mean-reverting return series (India ₹, Deccan Alloys Ltd, synthetic)

Deccan Alloys Ltd (synthetic, NSE-style) reports 240 months (20 years) of returns. You suspect momentum-and-reversal behavior and want to test it formally rather than eyeball a chart.

Solution. Step 1, the model. Fit r_t = c + φ·r_{t-1} + ε_t by OLS (regress r_t on r_{t-1} with a constant, exactly as QM1.02 taught). The fitted coefficients: ĉ = 0.00567, φ̂ = 0.4933, with a standard error on φ̂ of 0.0565 and t = 8.729 (p < 0.001), the autocorrelation is not a fluke. The regression's R² is 0.2433: about 24% of this month's return variance is explained by last month's return alone, which is a very high figure for real equity returns (flagged here only as a clean teaching case; genuine monthly stock-return autocorrelations of this size would themselves be a research finding worth double-checking).

Step 2, the implied long-run behavior. The implied unconditional mean is μ̂ = ĉ/(1-φ̂) = 0.00567/0.5067 = 0.01118 (about 1.12% a month) and the half-life of a shock is ln(0.5)/ln(0.4933) = 0.981 months, under one month, meaning a deviation from the mean is roughly halved by the next print. This is a genuinely fast-reverting process; contrast it with a φ of 0.9, whose half-life would run to 6.6 months (Practice Problem 2 asks you to compute this directly).

Step 3, the ACF/PACF signature confirms the model class. The sample ACF runs 1, 0.493, 0.192, 0.025, -0.015, -0.050, -0.082 at lags 0 through 6, decaying, roughly geometrically, toward zero, consistent with φ̂ᵏ (0.493¹=0.493, 0.493²=0.243, close to the sample's 0.192 given normal sampling noise). The sample PACF runs 1, 0.495, -0.069, -0.058, 0.010, -0.046, -0.053, a clear, sharp cutoff after lag 1, exactly the AR(1) fingerprint from the Box-Jenkins grid. Both signatures agree with the fitted model, which is the cross-check you always run before trusting a fit.

Step 4, forecast one and two steps ahead. The last observed return was r_T = 0.01199 (1.20%). The one-step forecast is ĉ + φ̂·r_T = 0.00567 + 0.4933(0.01199) = 0.01158 (1.16%); feeding that forecast back in, the two-step forecast is 0.00567 + 0.4933(0.01158) = 0.01138 (1.14%), each step converging a little further toward the long-run mean of 1.12%, exactly as an AR(1)'s theory predicts (a stationary AR(1)'s forecast always decays geometrically toward μ̂, never runs off to infinity, unlike the random-walk case in Worked Example 3).

Worked example 2: MA(1) versus AR(1): telling them apart from the correlogram (US $, Piedmont Short-Duration Income Fund, synthetic)

Piedmont Short-Duration Income Fund (synthetic, US-domiciled) reports 300 months of returns. Its manager explains that a rebate-timing effect hits this month's NAV and, through a lagged accrual, next month's, and then is fully gone. You want to confirm that story is an MA(1), not an AR(1).

Solution. Step 1: fit MA(1) by maximum likelihood. Fitting r_t = c + ε_t + θ·ε_{t-1} (an ARIMA(0,0,1) in the general notation) gives ĉ = 0.0040, θ̂ = 0.4973 with standard error 0.0539 and z = 9.227 (p < 0.001), a very clean recovery of a true θ of 0.5.

Step 2, the ACF cuts off; the PACF does not. The theoretical MA(1) autocorrelation at lag 1 is θ/(1+θ²) = 0.5/1.25 = 0.400; the sample ACF gives 0.351 at lag 1 (close, given sampling noise) and then -0.063, -0.046, -0.092, -0.071, -0.037 at lags 2 through 6, every one of them comfortably inside the approximate 95% band of ±1.96/√300 = ±0.113 for a series with no memory beyond lag 1. That is a clean cutoff, the MA signature. The PACF, by contrast, runs 1, 0.352, -0.214, 0.067, -0.135, 0.015, -0.048, decaying (with alternating sign) rather than cutting off, the mirror image of Worked Example 1's PACF.

Step 3, the diagnosis. If you had (incorrectly) fit an AR(1) to this same data instead, you would still get some non-zero coefficient (OLS always returns an answer) but the PACF's refusal to cut off after lag 1 is the tell that an AR(1) is the wrong model class here, exactly the discipline the Box-Jenkins grid exists to enforce. Reading the correlogram before choosing which model to fit, rather than fitting one model and hoping, is the entire point of this pair of worked examples.

Worked example 3: Is that a trend, or a random walk in a trench coat? Running the ADF test (US $, Piedmont Systems Inc., synthetic)

Piedmont Systems Inc. (synthetic, NYSE-style) trades from $100.00 and, over 756 trading days (about three years), climbs to $169.89, a 69.9% cumulative gain that, charted, looks like an unmistakable uptrend (snapshot: day 0, $100.00; day 126, $111.52; day 252, $129.56; day 378, $127.31; day 504, $140.97; day 630, $158.13; day 755, $169.89). Is this a genuine trend you can extrapolate, or something else?

Solution. Step 1, the trap. This series was generated (by construction, for this worked example) as a pure random walk with drift, P_t = P_{t-1} + 0.04 + ε_t, with no deterministic trend line anywhere in the data-generating process. The eye cannot tell that from a genuine deterministic uptrend; the ADF test can.

Step 2: ADF on the level. Testing the price level directly: ADF statistic = -0.9987, p = 0.7537, with 2 lags and critical values of -3.4391 (1%), -2.8654 (5%), -2.5688 (10%). Since -0.9987 is far less negative than even the loosest (10%) critical value, you fail to reject the null of a unit root, despite the unmistakable-looking uptrend, the level series cannot be distinguished from a random walk with drift.

Step 3: ADF on the difference. Testing the daily changes (ΔP_t) instead: ADF statistic = -18.9404, p ≈ 0.00000000, with 1 lag and the same critical-value table. This statistic is dramatically more negative than even the 1% critical value, so you strongly reject the unit root in the differenced series, daily price changes are stationary, exactly as the theory predicts for an I(1) process differenced once.

Step 4, the reading. The price level is I(1), a random walk with drift, and the returns are I(0). A deterministic trend line fit to the level and extrapolated forward would imply the drift itself is guaranteed to continue exactly on its historical line; what you actually have is a process whose expected forward path does drift upward on average, but whose realized path can and does wander arbitrarily far from any fixed line, with a variance that grows without bound the further out you forecast (recall the empirical variance-growth check from Core teaching content). The chart looked like proof of a trend; the test proved only that returns, not levels, are the well-behaved object here, which is exactly why every technique in this module (AR/MA fitting, VaR simulation) is built on returns, never on raw price levels.

Worked example 4: Cointegration and the pairs spread (India ₹, Konkan Public Bank & Sahyadri Public Bank, synthetic)

Two synthetic PSU-bank-style stocks, Konkan Public Bank and Sahyadri Public Bank, trade weekly for four years (208 weeks). Konkan moves from ₹254.50 to ₹233.80; Sahyadri moves from ₹183.28 to ₹164.27. Both individually look like they wander (ADF on Konkan alone: stat = -1.4274, p = 0.5691; ADF on Sahyadri alone: stat = -1.1852, p = 0.6799, both fail to reject a unit root, i.e., both are individually non-stationary). Is there a tradeable long-run relationship between them anyway?

Solution. Step 1. Engle-Granger, step one: estimate the hedge ratio. Regress Konkan on Sahyadri by OLS: Konkan_t = 79.08 + 0.9471·Sahyadri_t + resid_t, with a standard error on the slope of 0.0362 (t = 26.14) and R² = 0.7684. The 0.9471 is the hedge ratio: for every ₹1 Sahyadri moves, Konkan's fair-value co-movement is about ₹0.95. The residual, the spread, has mean 0 by OLS construction, standard deviation ₹4.23, and ranges from about -₹14.12 to +₹10.73 over the sample.

Step 2, Engle-Granger, step two: test the residual for a unit root: correctly. A naive Dickey-Fuller test run directly on this residual gives a statistic of -3.4614 against the plain ADF 5% critical value of -2.8762 (p ≈ 0.009), which looks like overwhelming evidence of stationarity. But this residual is not raw data; it is the leftover of an estimated regression, and testing it against the plain ADF table is exactly the mistake Common Mistake #4 warns about. Running the properly-adjusted Engle-Granger test (statsmodels.tsa.stattools.coint, which applies the correct MacKinnon response-surface critical values for this exact situation) gives a statistic of -3.4705 against the correct critical values of -3.9501 (1%), -3.3658 (5%), -3.0650 (10%), with p = 0.0351. The conclusion is the same, reject the unit root at 5%, the spread is stationary, the pair is cointegrated, but the honest margin is far thinner than the naive number suggested (0.035 is a real, defensible finding; 0.009 would have implied near-certainty that isn't actually there).

Step 3, read the spread as a signal. Converting the residual to a z-score ((resid - mean)/std), the five most recent observations run -6.83, -9.17, -0.45, -6.60, -0.86 in level, or -1.62, -2.17, -0.11, -1.56, -0.20 in z-score terms, the second-most-recent print, at a z-score of -2.17, is more than two standard deviations from the historical mean spread, which is precisely the kind of signal a pairs-trading strategy built on this relationship would flag for a mean-reversion trade (the actual strategy construction, position sizing, and execution belong to QD1.02/QD2.01, not here).

Step 4, the honest caveat. A cointegration finding is a statement about this four-year sample, not a law of nature (Common Mistake #7), the correct discipline is to re-test the relationship periodically, not to lever a pairs trade against a relationship you tested once in the past and never revisited.

Worked example 5: Spurious regression: two unrelated random walks that look devastatingly significant (Index Alpha & Index Beta, synthetic, unrelated)

Index Alpha and Index Beta are two synthetic indices, generated from entirely independent random processes with no shared driver whatsoever. Index Alpha runs from 100.08 to 91.67 over 208 weeks; Index Beta runs from 58.58 to 28.44. Naturally, you regress one on the other.

Solution. Step 1, the regression looks compelling. Alpha_t = 61.48 + 0.7175·Beta_t + resid_t, with t = 17.61 on the slope (p = 5.75×10⁻⁴³) and R² = 0.601. By the standards of an ordinary cross-sectional regression, this looks like an overwhelming, textbook-perfect relationship.

Step 2, the tell. The residual's Durbin-Watson statistic is 0.1022, a value near zero is the classic Granger-Newbold fingerprint of a spurious regression, because the "residual" here is itself a near-random-walk, wildly autocorrelated, nothing like the clean white noise OLS assumes.

Step 3, the correct test settles it. A naive Dickey-Fuller test on the residual gives -1.9521 against a plain-ADF 5% critical value of -2.8756 (p = 0.308): already a clear fail. The properly-adjusted Engle-Granger test (coint) gives -1.9608 against the correct critical values of -3.9501/-3.3658/-3.0650, with p = 0.549, even more decisively a failure to reject the unit root. The residual is non-stationary. There is no cointegrating relationship. The entire regression in Step 1, its striking R², its "impossibly significant" t-statistic, is spurious, an artifact of regressing one random walk on another, with zero economic content.

Step 4, the contrast with Worked Example 4. The correction (naive versus correctly-adjusted critical values) did not flip the conclusion here: both tests agreed on "not cointegrated". It did not flip the conclusion in Worked Example 4 either, where both agreed on "cointegrated". What the correction changed there was the margin, and that is the part worth carrying: a naive p of 0.009 implies near-certainty, while the correctly adjusted p of 0.0351 leaves a real but far thinner finding, and a strategy sized off the first number would be sized off something that is not there. Here the correction simply turns an already-clear "no" into a clearer one. The lesson generalizes: always run the properly-adjusted test, because you cannot know in advance whether the correction will merely reinforce your conclusion, thin its margin to something you would size differently, or quietly overturn it.

Worked example 6: Monte Carlo VaR on a two-asset INR/USD book

A book holds ₹50,00,000 (₹50 lakh) in a synthetic Nifty-linked fund and $60,000 in a synthetic US index fund. At an illustrative spot rate of ₹83.00/$ (synthetic, for this exercise), the dollar leg is worth ₹49,80,000 (₹49.8 lakh), for a total portfolio value of ₹99,80,000 (₹99.8 lakh). You need a 10-trading-day Value-at-Risk and Expected Shortfall.

Solution. Step 1: specify the process. Assign each leg a daily mean and volatility (INR leg: μ=0.05%, σ=1.1%; USD leg: μ=0.04%, σ=1.0%; USD/INR: μ=0.01%, σ=0.35%), scale to the 10-day horizon (μ_h = μ·10, σ_h = σ·√10), and specify a correlation matrix across the three risk factors (INR-equity/USD-equity ρ=0.35; INR-equity/FX ρ=-0.15; USD-equity/FX ρ=0.05: plausible, not fitted, synthetic assumptions). A Cholesky decomposition of the resulting covariance matrix turns independent standard-normal draws into correctly-correlated joint shocks.

Step 2: simulate and summarize. Simulating 100,000 ten-day scenarios (seeded for exact reproducibility) and revaluing the book multiplicatively (V₁(1+r₁) + V₂^{usd}(1+r₂)·S₀(1+r₃)) gives a simulated P&L distribution with mean ₹49,574 and standard deviation ₹2,74,150. Reading off the tail: VaR₉₅ = ₹4,01,754 (₹4.02 lakh), VaR₉₉ = ₹5,89,469 (₹5.89 lakh): 4.03% and 5.91% of portfolio value respectively, and ES₉₅ = ₹5,16,935 (₹5.17 lakh), ES₉₉ = ₹6,83,944 (₹6.84 lakh): the Expected Shortfall is, correctly, always worse than the VaR at the same confidence level, because it averages everything beyond the VaR cutoff rather than marking only its boundary.

Step 3: cross-check against a closed form. Because the simulation assumed joint normality, a parametric (delta-normal) estimate should closely agree: linearizing the portfolio's exposure gives a parametric mean of ₹49,900 and standard deviation of ₹2,74,324, implying VaR₉₅ = ₹4,01,335 and VaR₉₉ = ₹5,88,259: within 0.10% and 0.21% of the simulated figures respectively. That tight agreement is exactly the sanity check you want: two different methods, built on the same distributional assumption, landing in nearly the same place.

Step 4: convergence. Repeating the VaR₉₅ estimate 30 times at each of several simulation sizes shows the estimate's own standard error shrinking as theory predicts: at N=1,000 the estimate varies by about ±₹19,638 run to run; at N=10,000, about ±₹6,304; at N=100,000, about ±₹1,724, each 10× increase in simulations buying roughly a 3.1×–3.7× reduction in noise, consistent with the 1/√N law (and with the diminishing-returns lesson that follows from it).

Step 5, variance reduction, and its honest limits. Applying antithetic variates at a fixed N=10,000: for the mean P&L (a smooth, nearly linear statistic), the run-to-run standard error collapses from ₹3,055.5 to just ₹25.6, a 99.2% reduction, because antithetic pairs almost perfectly cancel each other's noise around a linear statistic. For the VaR₉₅ (an extreme-percentile, non-smooth statistic), the same technique reduces the run-to-run standard error only from ₹5,145 to ₹5,077, about 1.3%, a real but modest gain. The lesson: antithetic variates earns its keep on smooth, mean-type estimates far more reliably than on tail-quantile estimates like VaR, a distinction worth knowing before you assume a variance-reduction trick pays off uniformly everywhere you apply it.

Worked example 7: Overfitting made visible: polynomial degree, train error, test error, and cross-validation

A cross-sectional panel of 40 synthetic mid-cap companies (a mix of NSE- and NYSE-style names) reports next-quarter revenue growth against a single standardized macro-surprise feature. The true relationship is quadratic (y = 2 + 1.5x - 0.4x², plus noise); you, the analyst, do not know that in advance and must discover the right model complexity from data, with a matched 40-company test panel held out for an honest final read.

Solution. Step 1, fit increasing polynomial degrees and watch training error. Fitting degrees 1 through 12 by least squares on the 40 training companies, the training MSE falls monotonically: 0.7327 (degree 1) → 0.6712 (2) → 0.6493 (3) → 0.6439 (4) → 0.6436 (5) → 0.5906 (6) → 0.5905 (7) → 0.5834 (8) → 0.5295 (9) → 0.5294 (10) → 0.5235 (11) → 0.5230 (12). Judged purely on how well each model explains the data it was fit on, degree 12 looks unambiguously best.

Step 2, check the held-out test panel, and the story reverses. The test MSE on the 40 held-out companies runs 1.1977 (degree 1) → 0.9545 (2) → 0.9378 (3) → 0.8985 (4, the single-split minimum) → 0.8990 (5) → 1.1262 (6) → 1.1472 (7) → 1.0297 (8) → 2.3388 (9) → 2.5769 (10) → 1.2992 (11) → 1.2693 (12). Degree 1 (too rigid) underfits; the middle degrees do best; degree 9–10 blows up dramatically (test MSE more than double the best value) even though its training MSE looked great: textbook overfitting. (The mild recovery at degree 11–12 is a real, honest artifact of a single small test draw interacting with a numerically unstable high-degree fit, which is exactly why the next step exists.)

Step 3, cross-validate inside the training set, touching the test set not at all. Running 5-fold cross-validation using only the 40 training companies gives CV-MSE of 0.7866 (1) → 0.7322 (2, the CV minimum) → 0.7975 (3) → 0.7880 (4) → 0.8667 (5) → 1.1049 (6) → 1.7373 (7) → 6.1009 (8) → 1.6493 (9) → 7.2871 (10) → 32.5294 (11) → 73.8631 (12). Cross-validation correctly identifies degree 2, the actual true degree that generated the data, and shows an unmistakable, dramatic blow-up at high degree (a CV-MSE of nearly 74 at degree 12, versus a training MSE at that same degree of only 0.523) that the single train/test split's numbers only hinted at.

Step 4, the reading. The model chosen by cross-validation (degree 2) is not literally the single lowest number in the one-shot test-MSE column (that was degree 4, in this particular test draw), and that is exactly the point. Degree 4's apparent edge is itself a mild overfit to this one specific test sample; degree 2 is the choice you should trust, because it was chosen without ever touching the test set and because it recovers the true functional form. Had you instead kept adjusting your model until the test-set number looked best, you would have committed Common Mistake #10 (turned your test set into a second training set through repeated peeking) and would have no honest way left to estimate how the model will perform on data number 81.


Practice set

Work each problem before reading its solution. A calculator is assumed; where Python was used to verify a figure in the solution, the exact computation is described so you can reproduce it.

P1 (guided). AR(1) stationarity and mean. An AR(1) process has c = 0.004 and φ = 0.7. Is it stationary? What is its unconditional mean?

Solution. Stationary, because |φ| = 0.7 < 1. Unconditional mean μ = c/(1-φ) = 0.004/0.3 = 0.0133 (1.33%).

P2. Half-life at three different persistence levels. Compute the half-life (ln(0.5)/ln(φ)) for φ = 0.7, φ = 0.8, and φ = 0.9, and state in one sentence what rising φ does to a shock's persistence.

Solution. φ=0.7: ln(0.5)/ln(0.7) = 1.943 periods. φ=0.8: ln(0.5)/ln(0.8) = 3.106 periods. φ=0.9: ln(0.5)/ln(0.9) = 6.579 periods. Rising φ increases the half-life sharply (non-linearly), a process closer to a unit root takes far longer for any given shock to decay, which is exactly why φ approaching 1 is the warning sign of near-non-stationarity.

P3. MA(1) autocorrelation. An MA(1) process has θ = 0.6. Compute its theoretical ACF at lag 1 and state its ACF at lag 2 and beyond.

Solution. ρ(1) = θ/(1+θ²) = 0.6/1.36 = 0.4412. ρ(k) = 0 for all k ≥ 2, by definition, an MA(1) has memory of exactly one period and no further.

P4. Identify the process from its correlogram. A series' sample ACF decays smoothly from 0.71 at lag 1 to near zero by lag 6; its PACF is 0.71 at lag 1 and essentially zero at every lag beyond. What process class does this describe, and why?

Solution. AR(1). The ACF decaying gradually (not cutting off) while the PACF cuts off sharply after lag 1 is precisely the Box-Jenkins AR(1) signature, the direct one-period link (captured by the PACF) is all there is, and everything the ACF appears to show at longer lags is fully mediated through that single link.

P5. Identify the process from its correlogram, take two. A different series' sample ACF is 0.55 at lag 1 and close to zero at every lag beyond; its PACF decays gradually across several lags with alternating sign. What process class, and why?

Solution. MA(1). The ACF cutting off sharply after lag 1 while the PACF decays (rather than cutting off) is the mirror-image MA(1) signature.

P6. ADF null hypothesis and correct interpretation. State the null hypothesis of the (Augmented) Dickey-Fuller test in words, and explain why "the ADF test failed to reject the null" is not the same statement as "the series has a unit root, proven."

Solution. H₀: the series has a unit root (is non-stationary); H₁: the series is stationary. Failing to reject H₀ only means the sample did not supply enough evidence to rule out a unit root at the chosen significance level, it is never proof that a unit root is actually present, exactly as failing to reject any null hypothesis is never proof of that null (QM1.02's Type I/II framing applies identically here).

P7. Why non-standard critical values? Explain in one or two sentences why the ADF test cannot use an ordinary t-table for its critical values.

Solution. Under the null hypothesis of a unit root, the test statistic's distribution is not the familiar Student-t (or standard normal) distribution even asymptotically, it follows a different, skewed distribution derived by Dickey and Fuller (and tabulated more precisely via MacKinnon's response-surface method), which is systematically more negative than the ordinary t-table at any given significance level.

P8. Spot the spurious-regression tell. A regression of one price index on another yields R² = 0.55, a slope t-statistic of 14.2, and a Durbin-Watson statistic of 0.09. Should you trust this relationship? What is your next diagnostic step?

Solution. No, a Durbin-Watson statistic that close to zero is the classic spurious-regression fingerprint (extreme positive autocorrelation in the residuals), regardless of how impressive the R² and t-statistic look. The next step is to test the regression's residual for a unit root using the correctly-adjusted Engle-Granger/coint procedure (not a plain ADF table), only a rejection of the unit root in that residual would justify treating the relationship as real (cointegrated) rather than spurious.

P9. Engle-Granger, step by step. List, in order, the two steps of the Engle-Granger cointegration test, and state what a "pass" (i.e., a finding of cointegration) requires at step two.

Solution. Step 1: regress one I(1) series on the other by OLS to estimate the long-run relationship (the hedge ratio) and obtain the residual. Step 2: test that residual for a unit root using the correctly-adjusted critical values for a residual-based test (not the plain Dickey-Fuller table). A "pass" requires rejecting the unit root in the residual, i.e., the residual (spread) must be stationary, at your chosen significance level.

P10. Monte Carlo standard error scaling. A Monte Carlo estimate has a per-simulation standard deviation of ₹2,74,150. Compute the standard error of the mean estimate at N = 10,000, N = 100,000, and N = 1,000,000, and state how many times more simulations you need to cut the standard error exactly in half.

Solution. SE = σ/√N. At N=10,000: 274,150/√10,000 = ₹2,741.5. At N=100,000: 274,150/√100,000 = ₹866.9. At N=1,000,000: 274,150/√1,000,000 = ₹274.1. To halve the standard error you need 4× as many simulations (since SE ∝ 1/√N, halving SE requires √N to double, i.e., N to quadruple), a concrete illustration of Monte Carlo's diminishing returns.

P11. Antithetic variates, where it helps, where it doesn't. You are deciding whether to apply antithetic variates to (a) estimating a portfolio's mean expected P&L, and (b) estimating its 99th-percentile loss (VaR₉₉). Which benefits more, and why?

Solution. (a), the mean P&L, benefits far more. Worked Example 6 showed a 99.2% reduction in run-to-run standard error for a smooth, nearly linear statistic like the mean, versus only about 1.3% for the VaR₉₉ percentile. Antithetic pairing works by having offsetting errors cancel, which happens reliably for smooth/linear statistics but only weakly for a rough, order-statistic-based tail quantile.

P12. VaR versus Expected Shortfall. In one sentence each, distinguish what VaR₉₅ tells you from what ES₉₅ (Expected Shortfall) tells you about the same loss distribution.

Solution. VaR₉₅ tells you the loss threshold that is exceeded only 5% of the time (a single point on the distribution); ES₉₅ tells you the average loss, given that you are already in that worst 5% tail, how bad things typically are once VaR has already been breached, which is always a worse (larger) number than VaR at the same confidence level.

P13. Supervised or unsupervised? Classify each task as supervised (regression or classification) or unsupervised (clustering or dimensionality reduction): (i) predicting whether a loan will default given borrower features and historical default labels; (ii) grouping a universe of 500 stocks into similar-behaving clusters with no pre-assigned category; (iii) predicting next quarter's revenue growth from a set of financial ratios, using past quarters' actual growth as the target; (iv) collapsing 40 correlated macro indicators down to 3 uncorrelated composite factors.

Solution. (i) Supervised, classification (the target, default/no-default, is a known discrete label). (ii) Unsupervised, clustering (no target label; the algorithm discovers groupings). (iii) Supervised, regression (the target, revenue growth, is a known continuous value). (iv) Unsupervised, dimensionality reduction (no target; the goal is structure, not prediction).

P14. Diagnose from a train/test MSE table. A model's training MSE falls steadily from 2.1 at low complexity to 0.3 at high complexity, while its test MSE falls from 2.4 to a minimum of 1.1 at moderate complexity, then rises to 3.8 at the highest complexity tested. What is happening, and which complexity level should you choose?

Solution. Classic overfitting: training error keeps improving with complexity (the model increasingly memorizes training-set noise), while test error is U-shaped, improving as real signal is captured, then worsening once the model starts fitting noise rather than signal. Choose the complexity level at (or near) the test-error minimum (moderate complexity here), and ideally confirm that choice with cross-validation rather than a single test-error reading, per Worked Example 7's lesson.

P15. Look-ahead bias: spot it. A researcher builds a model to predict next-month stock returns from the prior month's data, then randomly shuffles all 240 months of history before splitting 80% into training and 20% into test. The backtest looks excellent. What is wrong, and what should be done instead?

Solution. The random shuffle destroys chronological order, so a substantial fraction of the "training" months fall after some of the "test" months in real time, the model was effectively allowed to learn from the future before being tested on the past, a textbook case of look-ahead bias. The backtest's apparent skill is unreliable. The fix: split chronologically (train on the earliest months, test strictly on the most recent, untouched months), or use a walk-forward/expanding-window scheme, exactly the discipline QD1.03's no_lookahead harness enforces automatically.

P16. Connect an AR(1) return process to a Monte Carlo simulation. You want to simulate 10,000 possible one-year paths for a stock whose monthly returns follow the AR(1) process fitted in Worked Example 1 (ĉ = 0.00567, φ̂ = 0.4933, and residual standard deviation to be estimated from the fit). Describe, in steps, how you would build this simulation, and state one thing that would be different here versus the i.i.d.-return Monte Carlo built in Worked Example 6.

Solution. Steps: (1) draw 12 months of i.i.d. normal shocks ε_t (mean 0, standard deviation equal to the AR(1) fit's residual standard error) per simulated path; (2) generate each month's return recursively as r_t = ĉ + φ̂·r_{t-1} + ε_t, starting from the last observed actual return (or the unconditional mean); (3) compound the twelve simulated monthly returns into a one-year path; (4) repeat for all 10,000 paths and read off the distribution of one-year outcomes exactly as in Worked Example 6. The key difference from Worked Example 6's simulation: there, each period's return was drawn independently (no φ term), so the Cholesky step only needed to handle cross-asset correlation at a single horizon; here, each month's return depends on the previous simulated month's return within the same path (autocorrelation through time, not just across assets), so the simulation must be built recursively, one month at a time within each path, rather than drawn all at once.

P17. Residual diagnostics on a quarterly AR fit. You fit an AR(1) to 44 quarters of a distributor's revenue growth and keep 43 residuals. Their autocorrelations are: lag 1 = +0.07, lag 2 = −0.18, lag 3 = +0.11, lag 4 = +0.52, lag 5 = +0.04, lag 6 = −0.14, lag 7 = +0.09, lag 8 = +0.36. (a) State the approximate two-standard-error band and which lags breach it. (b) Say what the pattern is and what term the model is missing. (c) The refitted model reports φ₁ = 0.31 and φ₄ = 0.74. State one thing you would check about those two numbers together before using the model to forecast.

Solution. (a) The band is ±2/√43 = ±0.3050. Two lags breach it: lag 4 at +0.52 and lag 8 at +0.36; every other lag sits inside. (b) A spike at the seasonal lag with a smaller echo at twice the seasonal lag is the seasonality signature on quarterly data, so the model is missing the lag-4 seasonal term, and refitting as x_t = c + φ₁·x_{t-1} + φ₄·x_{t-4} + ε_t is the fix. Note that the fitted AR(1) is not "wrong about the first lag"; it has simply been asked to carry structure it has no term for, which is why lag 1 itself looks clean at +0.07. (c) Check that φ₁ + φ₄ = 0.31 + 0.74 = 1.05 exceeds 1, so the fitted process is not stationary and its forecasts will diverge rather than revert. A sum above 1 on a short sample is usually over-stated persistence rather than a genuine explosive series, so the honest next steps are to re-test for a unit root, consider differencing, and refuse to publish a long-horizon forecast from this fit either way. Re-running the residual diagnostics on the refitted model is required as well, since fixing one lag does not certify the rest.


Applied mini-project

Build a time-series-and-Monte-Carlo workbook, end to end.

This project rehearses, in miniature, exactly what the app's Time-Series & Monte-Carlo Lab will grade. Use either a synthetic series you generate yourself (seeded, so it's reproducible) or a real return series from your own data source, clearly labeled, and if real, cited to its source (R3).

Do this, in order:

  1. Choose a market and pull or generate a return series. At least one India-flavored and one US-flavored series across your two chosen assets (an NSE-style and an NYSE-style name, real or clearly-labeled synthetic).
  2. Plot the ACF and PACF (six lags is enough) for each series and, from the correlogram alone, write down your candidate model class (AR, MA, or "no memory") before fitting anything.
  3. Fit your candidate model (AR(1) or MA(1)) and report the coefficient, its standard error, its significance, and (if AR) the implied half-life.
  4. Test stationarity on both the level and the return series with an ADF test, and write one sentence per series stating whether you reject or fail to reject the unit root, and at what significance level.
  5. Build a two-asset Monte Carlo simulation (India + US legs, plus an FX leg if you want the full three-factor version) at a 10-day horizon, with at least 10,000 simulations, and compute VaR₉₅, VaR₉₉, ES₉₅. Cross-check your simulated VaR₉₅ against a parametric (delta-normal) estimate and report the percentage difference.
  6. Run a convergence check: repeat your VaR₉₅ estimate at two different simulation sizes (e.g., 1,000 and 10,000) and report how much the estimate moves, connect this to the 1/√N law.
  7. Write a five-sentence reflection connecting this module's ML-framing section to your own work: if you were to predict next month's return for one of your two assets from lagged features, would a random train/test split be safe here? Why or why not?

Deliverable and self-check. One worksheet containing: your two chosen series (labeled real-and-cited or synthetic-and-seeded), your correlogram-based candidate-model prediction made before fitting, your fitted AR/MA output, your two ADF verdicts, your Monte Carlo VaR/ES table with the parametric cross-check and the convergence comparison, and your five-sentence reflection. Score yourself out of 10: 2 points for both markets present with correct labeling (R6/R3); 2 points for the correlogram prediction being written down before the fit (not adjusted afterward to match); 2 points for both ADF verdicts stated with the correct significance level and the correct "reject / fail to reject" language (never "proven"); 2 points for the Monte Carlo VaR/ES table plus a parametric cross-check within a reasonable range of each other; 1 point for the convergence comparison actually run (not merely asserted); 1 point for the reflection correctly identifying whether a random split is safe. Pass at 8/10 with no zero on any item.

Lab: open the Time-Series & Monte-Carlo Lab in this node's Practice tab, it hands you a fresh, never-seen synthetic series and book, and grades your fitted coefficients, your ADF call, and your VaR estimate against tolerance bands the same way this project asked you to self-check.


Reading & resources

Everything below is an anchor to learn from and verify against, never a source to quote a number from without recomputing it yourself (R3). Free unless marked; level tags reflect the ramp from intuition to full rigor.

The core spine (time series):

  • Hyndman & Athanasopoulos, Forecasting: Principles and Practice, the friendliest complete treatment of decomposition, ARIMA, and forecast evaluation, free online and continuously updated. [Free] [Beginner–Intermediate]
  • Box, Jenkins, Reinsel & Ljung, Time Series Analysis: Forecasting and Control, the namesake text behind the ACF/PACF identification grid this module teaches. [Paid] [Advanced]
  • Enders, Applied Econometric Time Series: the standard applied-econometrics treatment of unit roots, cointegration, and VECMs, with worked examples close to this module's level. [Paid] [Intermediate–Advanced]
  • Dickey & Fuller, "Distribution of the Estimators for Autoregressive Time Series with a Unit Root" (Journal of the American Statistical Association, 1979), the original unit-root test. [Paid/library] [Advanced]
  • Granger & Newbold, "Spurious Regressions in Econometrics" (Journal of Econometrics, 1974), the paper behind Worked Example 5. [Paid/library] [Advanced]
  • Engle & Granger, "Co-integration and Error Correction: Representation, Estimation, and Testing" (Econometrica, 1987), the paper behind Worked Example 4's two-step test. [Paid/library] [Advanced]

Monte Carlo & simulation:

  • Glasserman, Monte Carlo Methods in Financial Engineering, the standard graduate reference for variance reduction (antithetic variates, control variates, importance sampling) and simulation design in finance. [Paid] [Advanced]
  • QuantEcon lectures on Monte Carlo and stochastic simulation, free, code-adjacent, and a natural bridge toward the quant-code region. [Free] [Intermediate]

Intro machine learning (concepts, not code):

  • James, Witten, Hastie & Tibshirani, An Introduction to Statistical Learning (ISLR), the standard, freely available introduction to the supervised/unsupervised framing, train/test discipline, and cross-validation this module surveys; the same book DA cites for its code-level companion. [Free] [Beginner–Intermediate]
  • StatQuest (Starmer), the clearest short video explanations of bias-variance, cross-validation, and overfitting, free. [Free] [Beginner]

Primary-source anchors for this module's India + US market data (per R6, to check against once you build real datasets in the quant-code region):

  • RBI's Database on Indian Economy (DBIE) and NSE/BSE historical data archives, the India anchors for real return series and macro time series. [Free] [Beginner–Advanced]
  • FRED (Federal Reserve Economic Data) and SEC EDGAR, the US anchors for real macro and company time series. [Free] [Beginner–Advanced]

Do this, not just read: open a real (or your own synthetic) return series, plot its ACF/PACF by eye before fitting anything, and predict the model class from the shape alone, then fit the model and check whether your prediction held. That single loop, run on your own data once, will teach you more about reading a correlogram than any amount of further reading.


Teach it back & journal

Feynman prompt. Explain to a colleague who has just fit a beautiful-looking trend line to three years of rising prices why that line might be worthless for forecasting, using the idea that a random walk with drift can look identical to a deterministic trend over any finite sample, and only a stationarity test, never the naked eye, can tell them apart. Then, in the same breath, explain why a regression between two unrelated price indices can show a dazzling R² and t-statistic while being complete nonsense, using the idea that when both series carry a unit root, the ordinary regression machinery's own significance tests stop being trustworthy, and only a test on the residual settles it. If your colleague can, unprompted, ask "wait, did you test for a unit root before you trusted that regression?" the next time they see an impressive-looking chart, you have installed this module's central discipline.

Journal prompt. For one real dataset you have access to (or a synthetic one you build yourself), run the full loop this module taught: plot the correlogram and predict the model class before fitting anything; fit an AR or MA model and check whether the diagnostics agree with your prediction; run an ADF test and write down, honestly, whether you rejected or merely failed to reject the unit root; and if you regressed two series against each other anywhere in your own work recently, go back and check whether you ever tested the residual for a unit root, or simply trusted the R². Then write a paragraph on this: what is the one habit from this module, reading the correlogram before fitting, distinguishing "failed to reject" from "proven," checking a residual before trusting a regression, or recomputing a Monte Carlo estimate at a second, larger N before reporting it, that would most change how a colleague reads your quantitative work, and what will you do this week to make it automatic?


This module's flashcards and mastery quiz are wired into the app: see the node's Quiz and Reviews.

Advertisement

The gate

The module's flashcards and its quiz are in the app. The quiz is the gate: you need 85% to pass it, and the next module opens when you do.

Terms this module defines