A unit root process is a data-generating process whose first difference is stationary. In other words, a unit root process yt has the form
yt = yt–1 + stationary process.
A unit root test attempts to determine whether a given time series is consistent with a unit root process.
The next section gives more details of unit root processes, and suggests why it is important to detect them.
There are two basic models for economic data with linear growth characteristics:
Trend-stationary process (TSP): yt = c + δt + stationary process
Unit root process, also called a difference-stationary process (DSP): Δyt = δ + stationary process
Here Δ is the differencing operator, Δyt = yt – yt–1 = (1 – L)yt, where L is the lag operator defined by Liyt = yt – i.
The processes are indistinguishable for finite data. In other words, there are both a TSP and a DSP that fit a finite data set arbitrarily well. However, the processes are distinguishable when restricted to a particular subclass of data-generating processes, such as AR(p) processes. After fitting a model to data, a unit root test checks if the AR(1) coefficient is 1.
There are two main reasons to distinguish between these types of processes:
A TSP and a DSP produce different forecasts. Basically, shocks to a TSP return to the trend line c + δt as time increases. In contrast, shocks to a DSP might be persistent over time.
For example, consider the simple trend-stationary model
y1,t = 0.9y1,t – 1 + 0.02t + ε1,t
and the difference-stationary model
y2,t = 0.2 + y2,t – 1 + ε2,t.
In these models, ε1,t and ε2,t are independent innovation processes. For this example, the innovations are independent and distributed N(0,1).
Both processes grow at rate 0.2. To calculate the growth rate for the TSP, which has a linear term 0.02t, set ε1(t) = 0. Then solve the model y1(t) = c + δt for c and δ:
c + δt = 0.9(c + δ(t–1)) + 0.02t.
The solution is c = –1.8, δ = 0.2.
A plot for t = 1:1000 shows the TSP stays very close to the trend line, while the DSP has persistent deviations away from the trend line.
Forecasts based on the two series are different. To see this difference, plot the predicted behavior of the two series using
forecast. The following plot shows the last 100 data points in the two series and predictions of the next 100 points, including confidence bounds.
Examine the fitted parameters by executing
summarize(EstMdl) and you find
estimate did an excellent job.
The TSP has confidence intervals that do not grow with time, whereas the DSP has confidence intervals that grow. Furthermore, the TSP goes to the trend line quickly, while the DSP does not tend towards the trend line y = 0.2t asymptotically.
The presence of unit roots can lead to false inferences in regressions between time series.
Suppose xt and yt are unit root processes with independent increments, such as random walks with drift
xt = c1 + xt–1 + ε1(t)
yt = c2 + yt–1 + ε2(t),
where εi(t) are independent innovations processes. Regressing y on x results, in general, in a nonzero regression coefficient, and significant coefficient of determination R2. This result holds despite xt and yt being independent random walks.
If both processes have trends (ci ≠ 0), there is a correlation between x and y because of their linear trends. However, even if the ci = 0, the presence of unit roots in the xt and yt processes yields correlation. For more information on spurious regression, see Granger and Newbold .
There are four Econometrics Toolbox™ tests for unit roots. These functions test for the existence of a single unit root. When there are two or more unit roots, the results of these tests might not be valid.
yt = yt–1 + c + δt + εt,
which the functions test against an alternative model
yt = γyt–1 + c + δt + εt,
where γ < 1. The null and alternative models for a Dickey-Fuller test are like those for a Phillips-Perron test. The difference is
adftest extends the model with extra parameters accounting for serial correlation among the innovations:
yt = c + δt + γyt – 1 + ϕ1Δyt – 1 + ϕ2Δyt – 2 +...+ ϕpΔyt – p + εt,
L is the lag operator: Lyt = yt–1.
Δ = 1 – L, so Δyt = yt – yt–1.
εt is the innovations process.
Phillips-Perron adjusts the test statistics to account for serial correlation.
There are three variants of both
pptest, corresponding to the following values of the
'AR' assumes c and δ, which appear in the preceding equations, are both
'AR' alternative has mean 0.
'ARD' assumes δ is
'ARD' alternative has mean c/(1–γ).
'TS' makes no assumption about c and δ.
For information on how to choose the appropriate value of
'model', see Choose Models to Test.
The KPSS test,
kpsstest, is an inverse of the Phillips-Perron test: it reverses the null and alternative hypotheses. The KPSS test uses the model:
yt = ct + δt + ut, with
ct = ct–1 + vt.
Here ut is a stationary process, and vt is an i.i.d. process with mean 0 and variance σ2. The null hypothesis is that σ2 = 0, so that the random walk term ct becomes a constant intercept. The alternative is σ2 > 0, which introduces the unit root in the random walk.
The variance ratio test,
vratiotest, is based on the fact that the variance of a random walk increases linearly with time.
vratiotest can also take into account heteroscedasticity, where the variance increases at a variable rate with time. The test has a null hypotheses of a random walk:
Δyt = εt.
Transform your time series to be approximately linear before testing for a unit root. If a series has exponential growth, take its logarithm. For example, GDP and consumer prices typically have exponential growth, so test their logarithms for unit roots.
If you want to transform your data to be stationary instead of approximately linear, unit root tests can help you determine whether to difference your data, or to subtract a linear trend. For a discussion of this topic, see What Is a Unit Root Test?
model in as follows:
If your data shows a linear trend, set
If your data shows no trend, but seem to have a nonzero mean, set
If your data shows no trend and seem to have a zero mean, set
'AR' (the default).
true (default) if the data shows a linear trend. Otherwise, set
true if you want to test for independent, identically distributed innovations (no heteroscedasticity). Otherwise, leave
IID at the default value,
false. Linear trends do not affect
Setting appropriate lags depends on the test you use:
— One method is to begin with a maximum lag, such as the one recommended by Schwert . Then, test down by assessing the significance of the coefficient of the term at lag pmax. Schwert recommends a maximum lag of
where is the integer part of x. The usual t statistic is appropriate for testing the significance of coefficients, as reported in the
reg output structure.
Another method is to combine a measure of fit, such as SSR, with information criteria such as AIC, BIC, and HQC. These statistics also appear in the
reg output structure. Ng and Perron  provide further guidelines.
— One method is to begin with few lags, and then evaluate the sensitivity of the results by adding more lags. For consistency of the Newey-West estimator, the number of lags must go to infinity as the sample size increases. Kwiatkowski et al.  suggest using a number of lags on the order of T1/2, where T is the sample size.
For an example of choosing lags for
kpsstest, see Test Time Series Data for Unit Root.
pptest — One method is to begin with few lags, and then evaluate the sensitivity of the results by adding more lags. Another method is to look at sample autocorrelations of yt – yt–1; slow rates of decay require more lags. The Newey-West estimator is consistent if the number of lags is O(T1/4), where T is the effective sample size, adjusted for lag and missing values. White and Domowitz  and Perron  provide further guidelines.
For an example of choosing lags for
pptest, see Test Time Series Data for Unit Root.
vratiotest does not use lags.
Run multiple tests simultaneously by entering a vector of parameters for
test. All vector parameters must have the same length. The test expands any scalar parameter to the length of a vector parameter. For an example using this technique, see Test Time Series Data for Unit Root.
 Granger, C. W. J., and P. Newbold. “Spurious Regressions in Econometrics.” Journal of Econometrics. Vol 2, 1974, pp. 111–120.
 Schwert, W. “Tests for Unit Roots: A Monte Carlo Investigation.” Journal of Business and Economic Statistics. Vol. 7, 1989, pp. 147–159.
 Ng, S., and P. Perron. “Unit Root Tests in ARMA Models with Data-Dependent Methods for the Selection of the Truncation Lag.” Journal of the American Statistical Association. Vol. 90, 1995, pp. 268–281.
 Kwiatkowski, D., P. C. B. Phillips, P. Schmidt, and Y. Shin. “Testing the Null Hypothesis of Stationarity against the Alternative of a Unit Root.” Journal of Econometrics. Vol. 54, 1992, pp. 159–178.
 White, H., and I. Domowitz. “Nonlinear Regression with Dependent Observations.” Econometrica. Vol. 52, 1984, pp. 143–162.
 Perron, P. “Trends and Random Walks in Macroeconomic Time Series: Further Evidence from a New Approach.” Journal of Economic Dynamics and Control. Vol. 12, 1988, pp. 297–332.