4
matplotlib中自動關聯的計算方式與pandas.tools.plotting,sm.graphics.tsa.plot_acf等其他庫不同的是什麼?matplotlib中的自動關聯和pandas.tools.plotting中的自動關聯有什麼區別?
從下面的代碼我們可以注意到,這兩個庫返回的自動關聯值不同,就像matplotlib返回大於零的所有自動關聯值,並且pandas.tools.plotting返回一些-ve自動關聯值(除了置信區間,負x軸)。
import matplotlib.pyplot as plt
import statsmodels.api as sm
import pandas as pd
from pandas.tools.plotting import autocorrelation_plot
dta = sm.datasets.sunspots.load_pandas().data
dta.index = pd.Index(sm.tsa.datetools.dates_from_range('1700', '2008'))
del dta["YEAR"]
plt.acorr(dta['SUNACTIVITY'],maxlags = len(dta['SUNACTIVITY']) -1, linestyle = "solid", usevlines = False, marker='')
plt.show()
autocorrelation_plot(dta['SUNACTIVITY'])
plt.show()