I have the following code:
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
from pandas import ExcelWriter
import numpy as np
import pandas as pd
import seaborn as sns
import statsmodels.formula.api as smf
import statsmodels.tsa.api as smt
import statsmodels.api as sm
import scipy.stats as scs
from arch import arch_model
import sys
import matplotlib.pyplot as plt
import matplotlib as mpl
%matplotlib inline
df1 = df[['EURUSD Curncy']]
df1 = df1['EURUSD Curncy']
def tsplot(y, lags=None, figsize=(15, 12), style='bmh'):
if not isinstance(y, pd.Series):
y = pd.Series(y)
with plt.style.context(style):
fig = plt.figure(figsize=figsize)
#mpl.rcParams['font.family'] = 'Ubuntu Mono'
layout = (3, 2)
ts_ax = plt.subplot2grid(layout, (0, 0), colspan=2)
acf_ax = plt.subplot2grid(layout, (1, 0))
pacf_ax = plt.subplot2grid(layout, (1, 1))
qq_ax = plt.subplot2grid(layout, (2, 0))
pp_ax = plt.subplot2grid(layout, (2, 1))
y.plot(ax=ts_ax)
ts_ax.set_title('Time Series Analysis Plots')
smt.graphics.plot_acf(y, lags=lags, ax=acf_ax, alpha=0.5)#<-- this line here the issue
smt.graphics.plot_pacf(y, lags=lags, ax=pacf_ax, alpha=0.5)#<-- this line here the issue
sm.qqplot(y, line='s', ax=qq_ax)
qq_ax.set_title('QQ Plot')
scs.probplot(y, sparams=(y.mean(), y.std()), plot=pp_ax)
plt.tight_layout()
return
tsplot(df1.pct_change().dropna(), lags=30)
tsplot(df1.pct_change().dropna()**2, lags=30)
this function produces the following plot:
however the confidence interval that I am asking at 95% (alpha=0.5) is not plotted. If I take that line out of the function it works and interval are shown.
I am stuck, can you please help? thanks