Why my time series use seasonal_decompose() can see clear seasonal, but when apply it with adfuller(), the result shows it is stationary

Viewed 497

I think to my naked eye that there are seasonal time series that, when I use adfuller(), the results show the series is stationary based on p values.

I have also applied seasonal_decompose() with it. The results were pretty much what I expected

tb3['percent'].plot(figsize=(18,8))

what the series look like

One thing to note is that my data is collected every minute.

tb3.index.freq = 'T'
from statsmodels.tsa.seasonal import seasonal_decompose

result = seasonal_decompose(tb3['percent'].values,freq=24*60, model='additive')
result.plot();

the result of ETS decompose are shown in the figure below

ETS decompose

We can see a clear seasonality, which is same as what i expect

But when use adfuller()

from statsmodels.tsa.stattools import adfuller
 
result = adfuller(tb3['percent'], autolag='AIC')

the p-value is less than the 0.05, which means this series is stationary. Can anyone tells me why that happened? how can i fix it?

Because I want to use the SARIMA model to predict furture values, while use the ARIMA model predicts always a constant value of furture.

1 Answers

An Augmented Dickey Fuller test examines whether the coefficient in the regression

y_t - y_{t-1} = <deterministic terms> + c y_{t-1} + <lagged differences>

is equal to 1. It does not usually have power against seasonal deterministic terms, and so it is not surprising that you are not rejecting using adfuller.

You can use a stationary SARIMA model, for example

SARIMAX(y, order=(p,0,q), seasonal_order=(ps, 0, qs, 24*60))

where you set the AR, MA, seasonal AR, and seasonal MA orders as needed.

This model will be quite slow and memory intensive since you have 24 hours of minutely data and so a 1440 lag seasonal.

The next version of statsmodels, which has been released as statsmodels 0.12.0rc0, adds initial support for deterministic processes in time series models which may simplify modeling this type of series. In particular, it would be tempting to use a low order Fourier deterministic sequence. Below is an example notebook.

https://www.statsmodels.org/devel/examples/notebooks/generated/deterministics.html

Related