A Complete Introduction To Time Series Analysis (with R):: Tests for Stationarity

Hair Parra
Analytics Vidhya
Published in
7 min readJul 11, 2020

--

Different stationarity tests for the Lynx data

In the last article, we saw how we could estimate autocovariance by using a slightly modified version of the typical covariance sample estimator. Further, we saw that in reasonably large samples, this converges in distribution to a normal random variable. In this article, we will use this fact to construct some useful hypothesis tests for stationarity, to check, for instance, whether our decomposition analysis of a series in trend + seasonal component, that is, the residuals after having estimated and removed these, are correct.

Confidence bounds for the ACF

Assuming the ACF follows an underlying normal distribution,

Lagwise Test

We can make direct use of the C.I. above to estimate whether a series is truly stationary: we know that a true stationary series should have 0 autocovariance and therefore 0 autocorrelation, so that we can employ the hypothesis

So in particular, if Ho is true, we should have that

That is, the estimated confidence interval should contain the value 0 for most lags.

Portmanteau Test

This test is also quite straightforward; consider the hypothesis

--

--

Hair Parra
Analytics Vidhya

Data Scientist & Data Engineer. CS, Stats & Linguistics graduate. Polyglot.