Lecture 6 of 15
Trends, unit roots, and misleading level regressions
Will a shock decay, or permanently change the path?
Prerequisites: Lectures 2–5, regression standard errors, and first differences.
Unzip the bundle, open its code folder, and run ch06 in Python, R, or Julia; the entry point loads the course file and data beside it.
Two rising series can have different mechanisms
A deterministic-trend model is , where is stationary. A stochastic-trend model is . Their graphs can both rise. Their responses to a shock differ fundamentally.
In the first model, a disturbance to stationary eventually fades under stable dynamics and the series returns toward its deterministic path. In the second, a shock permanently changes the level of every future path. Subtracting a fitted line removes a deterministic trend under its assumptions; it does not eliminate the accumulated innovations of a random walk.
For the random walk, iteration gives . Its conditional forecast is , and its known-parameter error variance is . The forecast’s uncertainty grows with the horizon. A stable AR forecast’s variance instead approaches a finite limit.
If a series is stationary after one difference but not stationary in levels, we call it integrated of order one, , subject to the stated definition and regularity conditions. An series has stationary behavior in the relevant sense. Integration order is a statement about a process; finite-sample tests provide evidence about that statement, not certainty.
Differencing removes a unit root and can create dependence
Define . A random walk with drift satisfies . The accumulated stochastic trend disappears, leaving innovations and drift.
Differencing an already stationary white-noise series produces , an MA(1) with coefficient under our sign convention. Its variance is and its lag-one correlation is . The root lies on the invertibility boundary. Over-differencing can therefore manufacture a distinctive negative correlation and increase noise.
An ARIMA specifies a stationary ARMA model for . Forecast the differenced series, then integrate predictions back to levels using the observed initial level. For , a multi-step level forecast is the current level plus the sum of forecast differences. Its error variance requires covariances among those future difference errors; summing only their separate variances can be wrong.
Seasonal differencing targets a seasonal unit root. It is a different operation from subtracting seasonal dummy effects or Fourier terms. Combining ordinary and seasonal differences requires a substantive reason and diagnostics; the appearance of a repeating seasonal pattern alone does not prove a seasonal unit root.
The Dickey–Fuller regression
Begin with and subtract :
The unit-root null is ; the stable positive-persistence alternative has . A DF statistic is the fitted coefficient divided by its estimated standard error. Under the unit-root null, its distribution is not the usual regression Student distribution. The regressor accumulates innovations, and the asymptotics involve functions of a stochastic path.
Deterministic terms matter. A regression without a constant, with a constant, and with a constant plus trend have different null distributions. Do not move a critical value across these specifications. Choose deterministic terms from the economic question and maintained model, then retain the correct reference distribution.
The augmented Dickey–Fuller regression adds lagged differences:
The added terms address serial correlation under suitable conditions. Too few lags can leave dependence in ; too many can reduce power. Record the lag-selection rule and inspect residuals. Repeatedly trying deterministic terms and lags until a desired rejection appears changes the testing exercise.
A failure to reject does not establish that the process has a unit root. Near-unit stationary processes are hard to distinguish from unit-root processes in a short sample. A rejection can also be sensitive to a level break, trend break, or measurement change. Use the test with economic reasoning and later-target behavior.
The KPSS test of Kwiatkowski, Phillips, Schmidt, and Shin (1992) reverses the roles of the hypotheses. Its null is stationarity around the chosen deterministic terms, and its alternative is a unit root. It regresses on those terms, accumulates the residuals into partial sums , and compares with an estimate of the residuals’ long-run variance. Its null distribution is also nonstandard, it depends on the deterministic terms, and the long-run variance requires a bandwidth choice. Reading the two tests together is informative. When the ADF test rejects and KPSS does not, the evidence favors stationarity; when KPSS rejects and the ADF test does not, it favors a unit root. When both reject or neither does, the sample has not settled the question, and a near-unit root, a break, or an unsuitable bandwidth are candidate explanations.
A finite-sample simulation of the test
The laboratory generates independent unit-root paths under a specified simple null: zero-drift Gaussian random walks initialized at zero. It fits a DF regression with an intercept, no trend, and no augmented lags. For sample sizes 80, 240, and 720, it repeats the experiment 2,000 times and records the proportion of statistics below .
That threshold is an approximate conventional large-sample 5% reference for the intercept specification. This simulation does not create a calibrated finite-sample critical value for every application. Its purpose is to reveal the sampling variation in a claimed rejection rate and the effect of sample size under this specific data-generating process.
Independent replications require independent draws, and the way a simulation is seeded can remove that independence without any visible error. The laboratory takes every path from one Park–Miller stream with a single documented seed and splits the stream into consecutive blocks of draws. An earlier version of this laboratory reseeded replication with , and that scheme fails. The generator is multiplicative, so consecutive seeds produce first uniforms that differ by only . Over the 200 former replications, the first Box–Muller pair therefore always had a radius between 2.87 and 2.99, while its angle advanced by about 0.53 radians from one seed to the next. Across replications, the first two innovations each had a standard deviation of 2.07 instead of 1. The DF statistic with an intercept does not depend on the first draw of a path, but it does depend on the second, which had about four times its intended variance. Rejection rates computed that way therefore described a walk whose second step had the wrong distribution, drawn in replications that were not independent. Another base seed does not repair the scheme: seeds over 2,000 replications give a first-draw standard deviation of 1.64. The code now records the standard deviation of the first draw across replications, which should be close to one, and the verification suite fails when it is not.
If is a Monte Carlo rejection proportion from independent replications, its approximate simulation standard error is
With 2,000 replications, a proportion near 0.05 has an MCSE of about 0.005; with 200 replications it would be about 0.015, and differences of a few percentage points would be simulation noise. Increasing observations per replication and increasing replications address different uncertainties. The former changes the statistical experiment; the latter improves how accurately the simulation describes it.
The shared baseline produces rejection rates of 0.060, 0.0515, and 0.057 at , 240, and 720, each with an MCSE of about 0.005. The reference script repeats the design with 200,000 replications from NumPy’s generator and obtains 0.054, 0.052, and 0.050, with MCSEs near 0.0005. Each course rate lies within 1.3 of its Monte Carlo standard errors of the corresponding reference rate. The small excess over 0.05 at 80 observations is a genuine finite-sample effect: is an asymptotic critical value, and the 5% critical value for a sample of that length is slightly more negative. The differences among the course’s three rates are within simulation noise and say nothing about how size varies with sample length.
Dickey–Fuller size at the −2.86 reference: rejection proportions from 2,000 replications per sample size, drawn from one stream, with approximate 95% Monte Carlo error bars.
Why independent random walks can appear related
Suppose and , with independent innovation sequences. Regressing on a constant and in levels can generate misleading conventional significance. Each regressor carries a highly persistent random path. Usual stationary-regression laws do not justify the familiar standard-error calculation.
A single realization need not show the problem. The course’s baseline pair has a levels of about 0.0013 and a slope statistic of about 0.69. We retain that outcome, because the warning concerns the distribution of the procedure across many samples. The laboratory therefore repeats the experiment on 2,000 independent pairs of Gaussian walks for each sample size. The nominal 5% two-sided test of a zero slope in the levels regression rejects the true null in 74.8%, 84.4%, and 91.3% of replications at , 240, and 720, with MCSEs of 1.0, 0.8, and 0.6 percentage points. After differencing, the same test rejects in 4.8%, 4.2%, and 5.0% of replications, close to its nominal size. The reference script’s 200,000 replications give 73.7%, 84.8%, and 91.2% in levels and 5.4%, 5.0%, and 5.0% in differences.
The false-rejection rate rises with the sample. Granger and Newbold (1974) documented the phenomenon by simulation, and Phillips (1986) explained it: in the levels regression the slope estimate converges to a random variable, while the conventional statistic diverges at rate . More data make the misleading inference more confident.
Proportion of 2,000 replications in which the nominal 5% test rejects a zero slope for independent Gaussian random walks, in levels and in first differences, with approximate 95% Monte Carlo error bars.
Differencing this example gives independent innovations, restoring the intended simple regression setting. But differencing every economic pair indiscriminately can discard a genuine long-run relation. Lecture 11 will construct two series whose particular linear combination is stationary. Cointegration is the structured exception that must be investigated rather than assumed.
Execute, break, and repair
Run ch06 and inspect df_stat and unit_root_monte_carlo in the full source. Verify that the regression includes an intercept and that the reported statistic uses the lagged-level coefficient. Count the usable observations after differencing. The residual degrees of freedom are the number of usable rows minus the two fitted coefficients.
Deliberately compare the statistic with , the familiar normal threshold. Under this unit-root design, record how often that mistaken rule rejects. Restore the appropriate DF reference and compare. The repair changes the inferential rule; it does not change the fitted coefficient.
Next generate a deterministic trend plus a stable AR disturbance. Compare detrending and differencing using the correct target definition. Detrending estimates deviations from a deterministic path; differencing changes the series into period-to-period changes. Translate forecasts back into the original outcome units before comparing losses.
Finally add a known level break. Report how much the conclusions change when that break is represented explicitly. A unit-root decision should not be used to hide an obvious change in measurement or policy regime.
Worked problem and project audit
A random walk has drift 2, innovation variance 9, and current level 100. Its three-period forecast is 106 and its process-error variance is 27. A stable AR model with innovation variance 9 can also have a three-period variance near 27 when persistence is near one, but its long-horizon variance is finite if . Short-horizon similarity does not establish identical long-run behavior.
For a stationary white-noise series with variance 9, the differenced series has variance 18 and lag-one covariance . Its lag-one correlation is . Seeing this pattern after differencing is a reason to examine whether the transformation was needed.
During the prototype exchange, audit the partner’s choice of levels, differences, and deterministic terms. Identify what observation would challenge that choice. A defensible audit can conclude that the available sample does not resolve the distinction and recommend robust short-horizon benchmarks. It should not convert an inconclusive test into a confident declaration.
Sources
Dickey and Fuller (1979) derive unit-root estimator distributions. Kwiatkowski, Phillips, Schmidt, and Shin (1992) test the stationarity null. Granger and Newbold (1974) and Phillips (1986) analyze spurious regressions. The practical ARIMA framework is discussed in Forecasting: Principles and Practice.
Practice and laboratory for Lecture 6
- Assignment 6: Trends and testing, three tasks with worked answers.
- Run ch06 from the laboratory bundle in Python, R, or Julia.
- Lecture 6 summary, with the central equation, a problem, a failure, and its repair.