Statsmodels ACF Confidence Interval doesn't match - Python

Viewed 1052

I'm trying find number of significant output using ACF graph, however results of statsmodels.tsa.acf() confidence intervals don't match with statsmodels.graphics.tsa.acf() graph.

Sample code:

import statsmodels.api as sm
from statsmodels.graphics.tsaplots import plot_acf,plot_pacf

acf,confidence_interval=sm.tsa.acf(df_data,nlags=df_data.shape[0]-1,alpha=0.05,fft=False)

plot_acf(df_data,lags=df_data.shape[0]-1)

print(confidence_interval)

Here is the plot,

ACF Graph

However, confidence interval values returned from sm.tsa.acf() is way different comparing to the values in the graph.

Returned Values;

[[ 1.          1.        ]
 [-0.27174973  0.37268246]
 [-0.3286431   0.31742828]
 [ 0.0203798   0.66647139]
 [-0.61221928  0.10569058]
 [-0.61407253  0.14003004]
 [-0.42569193  0.35873921]
 [-0.58610165  0.19892257]
 [-0.64565391  0.15895208]
 [-0.34123344  0.49337893]
 [-0.53223297  0.30525403]
 [-0.56775509  0.2760946 ]
 [-0.02246426  0.83178741]
 [-0.55237867  0.37808097]
 [-0.53964256  0.39420078]
 [-0.19144858  0.74474359]
 [-0.63752942  0.33201877]
 [-0.66170085  0.31779123]
 [-0.5026759   0.48927364]
 [-0.63266561  0.35930273]
 [-0.60042286  0.39933612]
 [-0.50945575  0.49449365]
 [-0.47942564  0.52454691]
 [-0.48578234  0.51840072]
 [-0.32312106  0.68117201]
 [-0.40066389  0.61679615]
 [-0.3917795   0.63043611]
 [-0.35304025  0.67494402]
 [-0.52974159  0.50865544]
 [-0.57667548  0.46176601]
 [-0.5657842   0.47397661]
 [-0.61493365  0.42566845]
 [-0.57909456  0.46507539]
 [-0.54230719  0.50315461]
 [-0.51974363  0.52587038]
 [-0.53350424  0.5121135 ]
 [-0.52597853  0.51968465]]

It seems like first value is matching the graph then, it becomes quite unrelated. I find similar question at Statsmodels PACF plot confidence interval does not match PACF function , yet there was no solution. I read the documents, search through similar questions but I cannot find a solution.

How can I get the confidence interval values that are reflected on the graph?

0 Answers
Related