# Nice example where a series without a unit root is non stationary?

I've seen several times people reject the null in an augmented Dickey-Fuller test, and then claim that it shows their series is stationary (unfortunately, I cannot show the sources of these claims, but I imagine similar claims exist here and there in one or another journal).

I contend that it's a misunderstanding (that rejection of the null of a unit root is not necessarily the same thing as having a stationary series, especially since alternative forms of nonstationarity are rarely investigated or even considered when such tests are done).

What I seek is either:

a) a nice clear counterexample to the claim (I can imagine a couple right now but I bet someone other than me will have something better than what I have in mind). It could be a description of a specific situation, perhaps with data (simulated or real; both have their advantages); or

b) a convincing argument why rejection in an augmented Dickey-Fuller should be seen as establishing stationarity

(or even both (a) and (b) if you're feeling clever)

• $X_n = (-1)^n$ with probability 1. Nov 5 '15 at 5:30
• @cardinal Well, that certainly would get a rejection by the ADF test (edit: yep, it does), and it's clearly nonstationary (a root on the unit circle, but not a root equal to 1 which the ADF detects); so that would count. Nov 5 '15 at 7:32
• Note that ADF test has variants where trend is included. If the null is rejected, the series is trend-stationary, i.e. stationary if the trend is removed, but not stationary nevertheless. Nov 5 '15 at 8:00
• +1. Glen_b, would a linear trend + stationary AR(1) noise count as a counter-example? Feb 6 '17 at 12:20

Here is an example of a non-stationary series that not even a white noise test can detect (let alone a Dickey-Fuller type test): Yes, this might be surprising but This is not white noise.

Most non-stationary counter example are based on a violation of the first two conditions of stationary: deterministic trends (non-constant mean) or unit root / heteroskedastic time series (non-constant variance). However, you can also have non-stationary processes that have constant mean and variance, but they violate the third condition: the autocovariance function (ACVF) $cov(x_s, x_t)$ should be constant over time and a function of $|s-t|$ only.

The time series above is an example of such a series, which has zero mean, unit variance, but the ACVF depends on time. More precisely, the process above is a locally stationary MA(1) process with parameters such that it becomes spurious white noise (see References below): the parameter of the MA process $x_t = \varepsilon_t + \theta_1 \varepsilon_{t-1}$ changes over time

$$\theta_1(u) = 0.5 - 1 \cdot u,$$

where $u = t/ T$ is normalized time. The reason why this looks like white noise (even though by mathematical definition it clearly isn't), is that the time varying ACVF integrates out to zero over time. Since the sample ACVF converges to the average ACVF, this means that the sample autocovariance (and autocorrelation (ACF)) will converge to a function that looks like white noise. So even a Ljung-Box test won't be able to detect this non-stationarity. The paper (disclaimer: I am the author) on Testing for white noise against locally stationary alternatives proposes an extension of Box tests to deal with such locally stationary processes.

For more R code and more details see also this blog post.

Update after mpiktas comment:

It is true that this might look just like a theoretically interesting case that is not seen in practice. I agree it is unlikely to see such spurious white noise in a real world dataset directly, but you will see this in almost any residuals of a stationary model fit. Without going into too much theoretical detail, just imagine a general time-varying model $\theta(u)$ with a time varying covariance function $\gamma_{\theta}(k, u)$. If you fit a constant model $\widehat{\theta}$, then this estimate will be close to the time average of the true model $\theta(u)$; and naturally the residuals will now be close to $\theta(u) - \widehat{\theta}$, which by construction of $\widehat{\theta}$ will integrate out to zero (approximately). See Goerg (2012) for details.

Let's look at an example

library(fracdiff)
library(data.table)

layout(matrix(1:4, ncol = 2))
plot(tree.ring)
acf(tree.ring)
mod.arfima <- fracdiff(tree.ring)
mod.arfima$d ##  0.236507  So we fit fractional noise with parameter$\widehat{d} = 0.23$(since$\widehat{d} < 0.5$we think everything is fine and we have a stationary model). Let's check residuals: arfima.res <- diffseries(tree.ring, mod.arfima$d)
plot(arfima.res)
acf(arfima.res) Looks good right? Well, the issue is that the residuals are spurious white noise. How do I know? First, I can test it

Box.test(arfima.res, type = "Ljung-Box")
##
##  Box-Ljung test
##
## data:  arfima.res
## X-squared = 1.8757, df = 1, p-value = 0.1708

Box.test.ls(arfima.res, K = 4, type = "Ljung-Box")
##
##  LS Ljung-Box test; Number of windows = 4; non-overlapping window
##  size = 497
##
## data:  arfima.res
## X-squared = 39.361, df = 4, p-value = 5.867e-08


and second, we know from literature that the tree ring data is in fact locally stationary fractional noise: see Goerg (2012) and Ferreira, Olea, and Palma (2013).

This shows that my -- admittedly -- theoretically looking example, is actually occurring in most real world examples.

• +1, very nice example! I'm interested though are there any real life examples of such series? Feb 29 '16 at 18:22
• @mpiktas I added an update to the post that should answer your question. Mar 1 '16 at 5:12
• Thanks for the example. I found though few mistakes in your blog and in the paper of Ferreira et al. In your blog you state that the $\gamma_1(u)=\theta(u)$, when in fact it is $\sigma(u)\sigma(u-1/T)\theta(u)$. Also the sample ACF, i.e. $\hat\gamma_1$ converges to 0, not because $\int_0^1\theta(u)du=0$, but because $\int_0^1\theta(u)\sigma^2(u)du=0$, i.e. $\sigma(u)$ must be chosen in accordance with $\theta(u)$ for the statement to hold. In Ferreira et al, the definition (4) lacks $\varepsilon_t$. Mar 1 '16 at 7:52
• Your given example says that when we have time-varying model, fitting non-time varying model would lead to incorrect inference. But this is far from saying that each real time series can be be modelled with time-varying model. On the other hand your test can be applied to test for the presence of time-variation. Thanks again for an interesting insight. Mar 1 '16 at 8:00
• @mpiktas thanks for pointing that out. I corrected it in blogpost as well. In that case it just happened to work the same way out since $\sigma(u)^2$ is even around the mid point $0.5$ (with $T \rightarrow \infty$). And re practice: I didn't say every time series can be modelled that way. But in practice when someone models it with their favorite stationary ARFIMA model, then they already assume that it is in this class of family. (stationary models are a probability zero subset of locally stationary ones). Mar 5 '16 at 16:25

Unit root testing is notoriously difficult. Using one test is usually not enough and you must be very careful about the exact assumptions the test is using.

The way ADF is constructed makes it vulnerable to a series which are simple non-linear trends with added white noise. Here is an example:

library(dplyr)
library(tseries)
set.seed(1000)
oo <- 1:1000  %>% lapply(function(n)adf.test(exp(seq(0, 2, by = 0.01)) + rnorm(201)))
pp <- oo %>% sapply("[[","p.value")

> sum(pp < 0.05)
 680


Here we have the exponential trend and we see that ADF performs quite poorly. It accepts the null of unit root 30% of the time and rejects it 70% of the time.

Usually the result of any analysis is not to claim that the series is stationary or not. If the methods used in analysis require stationarity, the wrong assumption that the series is stationary when it is actually not, usually manifests in some way or other. So I personally look at the whole analysis, not only the unit root testing part. For example the OLS and NLS works fine for non-stationary data, where non-stationarity is in the mean, i.e. trend. So if somebody wrongly claims that the series is stationary and applies OLS/NLS, this claim might not be relevant.

• (+1) not only, but also for the neat way to avoid the loop in the simulation! Not that it matters for the overall conclusion, but: there seem to be 320 out of 1000 acceptances ($p>0.05$), no? Nov 5 '15 at 8:33
• Ah yes, I confused the signs. I fixed the answer accordingly. Thanks for noticing! Nov 5 '15 at 8:44
• Why didn't you use sapply(oo, "[[","p.value") ? Nov 5 '15 at 15:00
• Well I used it, only with pipe syntax. I like pipes :) Nov 5 '15 at 15:06
• I like dplyr too. For this code it is unnecessary, loading magrittr is sufficient. Nov 5 '15 at 15:41

# Example 1

Unit-root processes with a strong negative MA component are known to lead to ADF tests with empirical size far higher than the nominal one (e.g., Schwert, JBES 1989).

That is, if $$Y_t=Y_{t-1}+\epsilon_t+\theta\epsilon_{t-1},$$ with $\theta\approx-1$, the roots of the AR and MA part will almost cancel, so that the process will resemble white noise in finite samples, leading to many false rejections of the null, as the process still has a unit root (is nonstationary).

Below is an example for the ADF test that you mentioned. [Schwert simulates that much more extreme empirical sizes could be generated with less extreme MA structures if you looked at the coefficient statistic $T(\hat\rho-1)$ or the Phillips-Perron test instead, see his tables 5-10.]

library(urca)
reps <- 1000
n <- 100
rejections <- matrix(NA,nrow=reps)

for (i in 1:reps){
y <- cumsum(arima.sim(n = n, list(ma = -0.98)))
rejections[i] <- (summary(ur.df(y, type = "drift", selectlags="Fixed",lags=12*(n/100)^.25))@teststat < -2.89)
}
mean(rejections)


# Example 2

Processes that are mean-reverting but not stationary. For example, $Y_t$ might be an AR(1) process with AR coefficient less than one in absolute value, but with an innovation process whose variance changes permanently at some point in time ("unconditional heteroskedasticity"). The process then does not have a unit root, but is also not stationary, as its unconditional distribution changes over time.

Depending on the type of variance change, the ADF test will still reject frequently. In my example below, we have a downward variance break, which makes the test "believe" that the series converges, leading to a rejection of the null of a unit root.

library(urca)
reps <- 1000
n <- 100
rejections <- matrix(NA,nrow=reps)

for (i in 1:reps){
u_1 <- rnorm(n/2,sd=5)
u_2 <- rnorm(n/2,sd=1)
u <- c(u_1,u_2)
y <- arima.sim(n=n,list(ar = 0.8),innov=u)
rejections[i] <- (summary(ur.df(y, type = "drift"))@teststat < -2.89)
}
mean(rejections)


(As an aside, the ADF test "loses" its pivotal asymptotic null distribution in the presence of unconditional heteroskedasticity.)

• @Glen_b, that (I hope) could be an answer to your first paragraph, but not really to the title of your question - is there a discrepancy or a lack of understanding on my part? Nov 5 '15 at 8:02
• "That" = Example 1 Nov 5 '15 at 8:17
• It depends on what "unit root" is defined to be. I originally learned it as "root on the unit circle" (a root of modulus 1) but it now seems to be (and in the context of the ADF test relates to) a root of the characteristic polynomial actually equal to 1. Even if I have the wrong sense in the title your answer responds to the intended question, so think it's okay. Nov 5 '15 at 8:51
• My point is probably not clearly phrased: In the title you look for examples of series "without a unit root", whereas the first paragraph (to me) sounds like looking for examples in which rejecting is wrong. My first example is one for the latter case, in which ADF is likely to reject, although the process does have a unit root. Nov 5 '15 at 8:56
• Ah, sorry, I wasn't thinking about it properly. Yes, strictly it's not in keeping with either interpretation of the title, but it still responds to the broader question in the body. (Titles necessarily are less nuanced, so this isn't an issue.) ... I think it's a very interesting answer, and if anything serves my real purpose better than what the title asks for. Nov 5 '15 at 8:59