Skip to content

Instantly share code, notes, and snippets.

@mvervuurt
Created August 28, 2019 13:41
Show Gist options
  • Save mvervuurt/a3c4fa4fe991f1f3bcf26928f17285e1 to your computer and use it in GitHub Desktop.
Save mvervuurt/a3c4fa4fe991f1f3bcf26928f17285e1 to your computer and use it in GitHub Desktop.
Python Time Series Forecasting
# Load specific forecasting tools
from statsmodels.tsa.ar_model import AR,ARResults
model = AR(train['PopEst'])
AR1fit = model.fit(maxlag=1,method='mle')
start=len(train)
end=len(train)+len(test)-1
predictions1 = AR1fit.predict(start=start, end=end, dynamic=False).rename('AR(1) Predictions')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment