Difference between Plotting Rolling Statistics and Dickey-Fuller test for stationarity


I’m following this tutorial : https://www.analyticsvidhya.com/blog/2016/02/time-series-forecasting-codes-python/

I have a simple question on the part about Stationarity.
There are 3 cases. For each case, there is a plot of mean and std variation, and a Dickey-Fuller test.

But it’s not logical :
Why the 2nd case is the best one (1% critical value) while the plot shows a bigger variation on mean and std variation than the 1st case (5% critical value) and the 3th case (10% critical value)
By the way, the 3th case is clearly the best one according to the plot as the mean and std are clearly more constant than in others plot, but the Dickey-Fuller test says the opposite.

Do you have any explanations ?



Hi @superbromy,

Dickey-Fuller test is statistical tests for checking stationarity, while Rolling Statistics is more of a visual technique. In rolling statistics we plot the mean and standard deviation of the time series and see if it varies with time. Dickey-Fuller test comprise of a Test Statistic and some Critical Values for different confidence levels(1%, 5%, 10%). We visualize the results and if the ‘Test Statistic’ is less than the ‘Critical Value’, we can infer that the series is stationary.

Here different percentages represents various confidence levels. We generally consider results of 1% confidence interval as it will tell us whether the TS is stationary with 99% confidence.

Can you please specify that by 3rd case, which case are you referring to?
In this case, when we remove the trend and seasonality, we get the most stable mean and standard deviation and the result of Dickey-Fuller test also justifies that.