- 問題
- 答え
- 解説
次の Python コードの
exog 引数は何をしていますか?
Python コード:
import numpy as np, pandas as pd
from statsmodels.tsa.statespace.sarimax import SARIMAX
np.random.seed(42)
n = 200
z = (20 + 10*np.sin(2*np.pi*np.arange(n)/12)
+ np.random.randn(n)*2)
y = np.zeros(n)
for t in range(1, n):
y[t] = 0.5*y[t-1] + 1.5*z[t] + np.random.randn()*3
m1 = SARIMAX(y, exog=z, order=(1,0,0)).fit(disp=False)
m2 = SARIMAX(y, order=(1,0,0)).fit(disp=False)
print(f"モデルA AIC:{m1.aic:.2f}")
print(f"モデルB AIC:{m2.aic:.2f}")
print(f"\nモデルAの推定パラメータ:")
print(pd.Series(m1.params, index=m1.param_names))
回答の選択肢:
(A) 予測対象の変数を追加で指定している
(B) モデルの外側から影響を与える説明変数を組み込んでいる
(C) 季節周期の長さを指定している
(D) 予測期間の長さを指定している

