MehdiOua
MehdiOua

Reputation: 169

Python - How do I check time series stationarity?

I have a car speed dataset on a highway. The observations are collected at 15 min steps, which means I have 96 observations per day and 672 per week. I have a whole month dataset (2976 observations)

My goal is to predict future values using an Autoregressive AR(p) model.

Here's my data repartition over the month. enter image description here

In addition, here's the autocorrelation plot (ACF)

enter image description here

The visualization of the 2 plots above lead to think of a seasonal component and hence, a non-stationnary time series, which for me makes no doubt.

However, to make sure of the non-stationarity, I applied on it a Dickey-Fuller test. Here are the results.

Results of Dickey-Fuller Test:
Test Statistic                -1.666334e+01
p-value                        1.567300e-29
#Lags Used                     3.000000e+00
Number of Observations Used    2.972000e+03
Critical Value (5%)           -2.862513e+00
Critical Value (1%)           -3.432552e+00
Critical Value (10%)          -2.567288e+00
dtype: float64

The results clearly show that the absolute value of Test statistic is greater than the critical values, therefore, we reject the null hypothesis which means we have a stationary series !

So I'm very confused of the seasonality and stationarity of my time series. Any help about that would be appreciated.

Thanks a lot

Upvotes: 1

Views: 1465

Answers (1)

Adelson Araújo
Adelson Araújo

Reputation: 342

Actually, stationarity and seasonality are not controversial qualities. Stationarity represent a constancy (no variation) on the series moments (such as mean, variance for weak stationarity), and seasonality is a periodic component of the series that can be extracted with filters.

Seasonality and cyclical patterns are not exactly the same thing, but are very close. You can think as if this series in the images that you show can have a sum of sines and cosines that repeats itself for weekly (or monthly, yearly, ...) periods. It does not have any correlation with the fact that the mean value of the series seems to be constant over the period, or even variance.

Upvotes: 1

Related Questions