Fitting Prelude
Great, you understand model order! Understanding the order is important when it comes to fitting models. You will always need to select the order of model you fit to your data, no matter what that data is.
In this exercise you will do some basic fitting. Fitting models is the next key step towards making predictions. We'll go into this more in the next chapter but let's get a head start.
Some example ARMA(1,1) data have been created and are available in your environment as y
. This data could represent the amount of traffic congestion. You could use forecasts of this to suggest the efficient routes for drivers.
This exercise is part of the course
ARIMA Models in Python
Exercise instructions
- Import the
ARIMA
model class from thestatsmodels.tsa.arima.model
submodule. - Create a model object, passing it the time series
y
and the model order(1,0,1)
. Assign this to the variablemodel
. - Use the model's
.fit()
method to fit to the data.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import the ARIMA model
from ____ import ____
# Instantiate the model
model = ____(____, order=____)
# Fit the model
results = ____