Python ARIMA exogenous variable out of sample

后端 未结 3 2168
广开言路
广开言路 2021-02-14 13:04

I am trying to predict a time series in python statsmodels ARIMA package with the inclusion of an exogenous variable, but cannot figure out the correct way to insert the exogeno

3条回答
  •  眼角桃花
    2021-02-14 13:43

    If any one is using forecast function this worked for me for one step prediction.

    history is training array

    exog is external variable array

    Y_exog_test is out of sample corresponding external variable. Change it to ARIMAX and it should work

    model = sm.tsa.statespace.SARIMAX(history, trend='c', order=(1,1,1),seasonal_order=(0,1,0,24),exog=yexog)
    
    model_fit = model.fit()
    
    predicted = model_fit.forecast(step=1,exog=[[Y_exog_test]], dynamic=True)
    

提交回复
热议问题