Deprecated ARMA module

Viewed 75

I'm following a Time Series Analysis module on DataCamp and tried using the exact same code in Jupyter notebook:

# Import the ARMA module from statsmodels
from statsmodels.tsa.arima_model import ARMA

# Forecast the first AR(1) model
mod = ARMA(simulated_data_1, order=(1,0))
res = mod.fit()
res.plot_predict(start=990, end=1010)
plt.show()

enter image description here

However, I keep getting the following error:

NotImplementedError: 
statsmodels.tsa.arima_model.ARMA and statsmodels.tsa.arima_model.ARIMA have
been removed in favor of statsmodels.tsa.arima.model.ARIMA (note the .
between arima and model) and statsmodels.tsa.SARIMAX.

statsmodels.tsa.arima.model.ARIMA makes use of the statespace framework and
is both well tested and maintained. It also offers alternative specialized
parameter estimators.

After making some adjustments by using the correct package, I was able to get a chart but not the confidence interval as in the first image.

# Import the ARMA module from statsmodels
from statsmodels.tsa.arima.model import ARIMA
    
# Fit an AR(1) model to the first simulated data
model = ARIMA(simulated_data_1, order=(1,0,0))
result = model.fit()
    
plt.plot(simulated_data_1[990:])
plt.plot(result.predict(start=990, end=1010, ax=ax), color='red')
plt.show()

enter image description here

How can I add in the confidence interval?

0 Answers
Related