0% found this document useful (0 votes)
80 views7 pages

Time Series Predictions Using Arima & Sarimax

Uploaded by

ante mitar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views7 pages

Time Series Predictions Using Arima & Sarimax

Uploaded by

ante mitar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

#Standard Imports

from statsmodels.tsa.seasonal import seasonal_decompose


from statsmodels.tsa.stattools import adfuller
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
from matplotlib.pylab import rcParams
from pmdarima import auto_arima
from statsmodels.tsa.arima_model import
ARIMA,ARIMAResults,ARMA,ARMAResults
import statsmodels.api as sm
from statsmodels.tsa.statespace.sarimax import SARIMAX

Sarimax_model = auto_arima(data_diff['passengers'],
start_P=1,
start_q=1,
max_p=3,
max_q=3,
m=12,
seasonal=True,
d=None,
D=1,
trace=True,
error_action='ignore',
suppress_warnings=True,
stepwise=True)

Sarimax_model.summary()

model = SARIMAX(df['passengers'],order=(1, 0, 1),


seasonal_order=(2, 1, 0, 12),
enforce_stationarity=False,
enforce_invertibility=False)

results = model.fit()

forecast = results.predict(start = len(df),


end=len(df)+24,
typ='levels')
.rename('data sarimax (1,0,1) forecast')

df['passengers'].plot(figsize=(12,8),legend=True)
forecast.plot(legend=True)

You might also like