application_vnd.jupyter.stderr_output_1.png image_output_1.png
from random import random

from statsmodels.tsa.ar_model import AR

from statsmodels.tsa.arima_model import ARMA

import matplotlib.pyplot as plt

xdata = range(1, 100)
ydata = [x + 3 * random() for x in xdata]
plt.xlim(0, 100)
plt.ylim(0, 100)
model = AR(ydata)
model_fit = model.fit()

yhat = model_fit.predict(start=90, end=110)

model = ARMA(ydata, order=(0, 1))
model_fit = model.fit(disp=False)
yhat = model_fit.predict(start=90, end=110)

model_fit = model.fit(disp=False)
yhat = model_fit.predict(start=90, end=110)
print('Predicted value for Moving Average 2,1 ', yhat)