What is Stationarity in Time Series? How it can be detected?

Sandhya Krishnan
CodeX
Published in
3 min readOct 18, 2021
Photo by Felix Mittermeier from Pexels

A time series has stationarity when the observations are not dependent on the time. Statistical properties of these time series will not change with time thus they will have constant mean, variance, and covariance.

Visualization of a stationary times series will be as below.

Non Stationary time series will have nonconstant mean, variance, or covariance.

The time series which have trends or with seasonality, are not stationary. Because trends will have a change in the movement of data concerning time which will cause the change in mean over time. Whereas seasonality occurs when the pattern in time series shows a variation for a regular time interval which will cause the variance to change over time.

Cyclic behavior and white noise in time series are stationary. The cyclic behavior of time series will be stationary because the cycles are not of a fixed length, so before we observe the series we cannot be sure where the peaks and troughs of the cycles will be.

White noise will have a mean of zero and its variables are independent and it will look much the same at any point in time.

When a time series is non-stationary, the mean and variance, and covariance keep on changing, so it will not be possible to find accurate inference from them even estimate is made after averaging them.

Stationarity of time series can be detected by:

  1. Visually Plotting the time series and check for trend or seasonality.
  2. By Splitting time series into the different partitions and compare the statistical inference.
  3. Can perform Augmented Dickey-Fuller test to check the stationarity.

Augmented Dickey-Fuller (ADF) test is a statistical test that belongs to the unit root test which tests the null hypothesis.

The unit root is a characteristic of a time series which makes it non-stationary. A linear stochastic process has a unit root if 1 is a root of the process’s characteristic equation. Such a process is non-stationary but does not always have a trend.

If alpha =1 in the below equation, then unit root exists in time series (that is time series is not stationary)

Yt is the value of time series at time t.

In ACF, the null hypothesis (H0) is considered as test time series is not stationary that is it has a unit root and alternative hypothesis is considered as time series is stationary that is it has no unit root.

Time-series models like ARIMA assume that the data is stationary. Because when the time series is stationary, the mean and variance and covariance are constant and we can accurately do the statistical analysis.

In ACF to conclude that the time series is stationary, the null hypothesis should be rejected.

To reject the null hypothesis either the p-value should be less than the default significance level of 5% or the test statistic is less than the critical value.

If the data is not stationary, then data has to be transformed before modeling the ARIMA model.

The two most common methods to transform series into stationarity are:

  • Transformation: Using log or square root to stabilize the non-constant variance.
  • Differencing: subtracts the current value from the previous one. Differencing can be done in different orders like first-order differencing(will have linear trend), second-order differencing(will have quadratic trends), etc.

--

--