text_plain_output_1.png
from statsmodels.tools.eval_measures import rmse

from statsmodels.tsa.statespace.sarimax import SARIMAX

import matplotlib.pyplot as plt

import pandas as pd

df = pd.read_csv('/kaggle/input/time-series-datasets/monthly-beer-production-in-austr.csv')

df.Month = pd.to_datetime(df.Month)

df = df.set_index('Month')

rolling_mean = df.rolling(window=12).mean()
rolling_std = df.rolling(window=12).std()

plt.xlabel = 'Dates'
plt.ylabel = 'Total Production'

train_data = df[:len(df) - 12]
test_data = df[len(df) - 12:]

arima_model = SARIMAX(train_data['Monthly beer production'], order=(2, 1, 1), seasonal_order=(4, 0, 3, 12))
arima_result = arima_model.fit()
arima_result.summary()

arima_pred = arima_result.predict(start=len(train_data), end=len(df) - 1, typ='levels').rename('ARIMA Predictions')
arima_pred

arima_rmse_error = rmse(test_data['Monthly beer production'], arima_pred)
arima_mse_error = arima_rmse_error ** 2
mean_value = df['Monthly beer production'].mean()
print(f'MSE Error: {arima_mse_error}\nRMSE Error: {arima_rmse_error}\nMean: {mean_value}')