Pythonで学ぶ時系列データの可視化
Thomas Vincent
Head of Data Science, Getty Images
t_1, t_2, t_3, ...)と3時点分ラグをとった値(t_4, t_5, t_6, ...)の相関を返します
statsmodelsは、様々な統計モデルの推定、統計検定、データ探索のためのクラスと関数を提供するPythonモジュールです。
import matplotlib.pyplot as plt
from statsmodels.graphics import tsaplots
fig = tsaplots.plot_acf(co2_levels['co2'], lags=40)
plt.show()

order 3 の偏自己相関関数は、時系列(t1, t2, t3, ...)と3時点ラグの値(t4, t5, t6, ...)の相関を、ラグ1および2の影響を除いたうえで返しますimport matplotlib.pyplot as plt
from statsmodels.graphics import tsaplots
fig = tsaplots.plot_pacf(co2_levels['co2'], lags=40)
plt.show()

Pythonで学ぶ時系列データの可視化