# What is Stationarity?

*Marina Feren**ț-***Pipaș, Data Scientist
**

*marina.ferent@orpheusindices.com*

**Mean Reversion**

Mean reversion has been the corner-stone in differentiating the random from the non-random behavior. Stationarity is used to identify mean reversion in a time series.

A critical role in classical time series analysis is played by the concept of stationary processes. Stationary processes are easier to be modeled and to develop asymptotic theories. The concept has a longer history, implying that a wider pool of research technics have been developed in the area.

The stationarity tests gained popularity in the behavioral finance sphere. They provide a tool for showcasing the existence of mean reverting processes, i.e. as time duration increases, the time series tend to revert to the mean. As such, looking at mean reverting patterns explain non-random behavior. This allows for a better understanding of systems and for more accurate prediction on the analyzed series future behavior.

**Stationarity assumptions**

Stationary processes are series that do not have a trend component.

A time series process is strongly (strictly) stationary if its distribution is time independent. As such, its distribution function should be identical throughout different time intervals. The distribution’s parameters are thus presumed to remain constant, i.e. the mean, variance, autocorrelation does not change in time. Weaker forms of stationarity such as covariance stationarity relax the assumptions to finite moments (parameters). The below graph portrays a stationary process.

**Graph 1: ***Stationary and N0n-Stationarity Process*

**Difference stationarity and trend stationarity**

The name of the two is derived from the correction method applied to the specific non-stationary processes in order to transform them into stationary series.

Trend stationarity deals with a stationary process which instead of having a constant mean would have a trending one, i.e. a constant mean around a deterministic trend. Such a process is portrayed in Graph 2.

A deterministic trend supposes that in case of a severe shock, the trend’s path would be affected only in the short run; in the long run the series would regain its initial trend path. In order to obtain a stationary process, the series has to be de-trended. Regressing with respect to the trend and constant variables and extract the obtained residuals is a popular de-trending method.

A case of difference stationarity is random walk processes. In such cases, the series is said to possess a stochastic trend. As opposed to the deterministic trend presented above, a severe shock would affect the stochastic trend’s path in the long run, i.e. the series will not regain its pre-shock trend path. A random walk series is portrayed in Graph 2.

A stationary process is obtained from a stochastic trending process by differencing. The obtained series is called integrated of order x (I(x)), where x denotes the number of times the series needs to be differentiated so to get to the stationary process.

As mentioned by Cochrane (1987) and Hamilton (1994), it is hard to distinguish between these two types of stationarity in case of a finite amount of data; in such situations, both a deterministic (trend stationary) and a stochastic trend may fit well the data.

**Graph 2: ***Trend stationarity (a) vs. Random walk (b) processes*

**Testing for stationarity in R**

Stationarity tests are important tools used in assessing time series’ behavior and forecasting future values of the series in question. For the easiness of the exercise, most of the predicting methods assume that the statistical parameters remain constant over time i.e. the time series is a stationary process.

The methodology presented below was used in the *Stock Market Stationarity *paper (Pal and Ferenț, 2015) and encompasses a simple and straightforward way of testing for the presence of stationarity in a percentile ranking series with the final goal of testing for the existence of behavior in the defined ranking framework. The trend and difference stationarity classifications are relevant for a time series. However, considering the dynamic nature of markets, our case of looking at broad stationarity seemed like a needed simplification to understand market dynamics as a group. When components are interacting at a multi-durational level, identifying the stochastic and trend behavior in an individual time series, is like shooting in the dark. The simplification hence overcomes some of the limitations and failures of stationarity as a statistical measure for mean reversion.

Standard Dickey-Fuller (DF) tests for the null hypothesis of the presence of a unit root in the time series. DF is based on the fact that if a time series (in the present case, the ranking series) is a stationary process, then the current ranking should be similar to the one of the previous period. The extended version of DF i.e. Augmented Dickey-Fuller (ADF) has the same purpose as the standard one, but it controls for the existence of serial correlation by including lagged changes of the variable. A critical point here is deciding upon the number of lags introduced in the model as too many lags may affect and decrease the sample power of the test. While in case of introducing too many lags, the size of the test is affected. As such, the loaded test used the Bayesian-Information Criterion (BIC) in order to discriminate between the models and choose the optimum number of lags to be used.

In order to implement the test in R it was used the *ur.df* function from the *urca* package. This allows for lags auto selection as previously mentioned and comes with three testing options:

- With trend and drift

*∆Y _{t}=μ+γY_{t-1}+βt+δ_{1}Δy_{t−1}+*

*⋯*

*+δ*

_{p−1}Δy_{t−p+1}+ἐ_{t}*where μ – drift, Y-the rank of the observed stock, β-trend coefficient, p-the lag order selected based on BIC*

- With drift

*∆Y _{t}=μ+γY_{t-1}+ δ_{1}Δy_{t−1}+*

*⋯*

*+δ*

_{p−1}Δy_{t−p+1 }+ἐ_{t}*where μ – drift, Y-the rank of the observed stock, p-the lag order selected based on BIC*

- None of the above

*∆Y _{t}= γY_{t-1}+δ_{1}Δy_{t−1}+*

*⋯*

*+δ*

_{p−1}Δy_{t−p+1 }+ἐ_{t}

*where Y-the rank of the observed stock, p-the lag order selected based on BIC*

The test was conducted only with drift considering the above mentioned reasons. In this case the test returns

*tau2*critical value which stands for the null that

*γ*= 0; as such in case the critical value falls in the fail to reject the null area, then the rankings series is not stationary. A basic example is provided below. Walter Enders (

*Applied Econometric Time Series*, 3rd Edition) as well as Leila Ayat and Peter Burridge (

*Unit root tests in the presence of uncertainty about the non-stochastic trend,*Journal of Econometrics, Vol. 95, No. 1, 01.03.2000, p. 71-96) are recommended for further study.

Consider

*series*as the variable to be tested using the ADF test with drift only; the lags selection will be done based on BIC.

**R Code**

*test=ur.df(series, type = “drift”, selectlags=”BIC”)*

*summary(test)*will return the test’s output:

<-

###############################################

# Augmented Dickey-Fuller Test Unit Root Test #

###############################################

Test regression drift

Call:

lm(formula = z.diff ~ z.lag.1 + 1 + z.diff.lag)

Residuals:

Min 1Q Median 3Q Max

-0.64978 -0.00933 0.00025 0.01002 0.64969

Coefficients:

Estimate Std. Error t value Pr(>|t|)

(Intercept) 2.683e-03 8.278e-04 3.241 0.001200 **

z.lag.1 -5.242e-05 1.454e-05 -3.604 0.000316 ***

z.diff.lag 9.890e-01 2.045e-03 483.668 < 2e-16 ***

—

Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.02911 on 5114 degrees of freedom

Multiple R-squared: 0.9786, Adjusted R-squared: 0.9786

F-statistic: 1.172e+05 on 2 and 5114 DF, p-value: < 2.2e-16

Value of test-statistic is: -3.6043 6.5173

Critical values for test statistics:

1pct 5pct 10pct

tau2 -3.43 -2.86 -2.57

phi1 6.43 4.59 3.78

In order to check for the null of the presence of a unit root, the first empirical value reported in the test-statistic is to be compared with the values of tau2. In case the t-statistic of the test is higher than the critical value for the given significance level, the null cannot be rejected and it is concluded that

*series*has a unit root; otherwise, it is a stationary process.

As such, in the above example, for a 5% significance level, one will compare -3.6043 with -2.86. As the value of the test-statistic is lower than the critical value of tau2 at 5% significance level, the null is rejected and it is concluded that

*series*is a stationary process.

For the easiness of the exercise, the parameters can be stored and compared; for example:

**R Code**

attributes=attributes(test)*if(attributes$teststat[1] < attributes$cval[1,2]) {*

*print(“stationary”)*

*} else {*

*print (“unit root”) }*

<-

<-

The

*attributes$teststat*returns the empirical values of the test statistic, whereas the

*attributes$cval*returns the critical values for test-statistic.

**Bibliography**

- Ayat, L. and Burridge, P., Unit root tests in the presence of uncertainty about the non-stochastic trend
*, Journal of Econometrics*, Vol. 95, No. 1, 01.03.2000, p. 71-96 - Enders, W. (2009).
*Applied Econometric Time Series (3*. Wiley Publishing House, United States of America^{rd}edition) - Pal, M. and Ferent-Pipas, M. (2015), Stock Market Stationarity
*, Social Science Research Network*. Available online at: http://ssrn.com/abstract=2608336 - Wooldridge, J. (2002).
*Introductory Econometrics: A Modern Approach (2*. South-Western Educational Publishing House, United States of America^{nd}edition)