Autoregressive model example
Autoregressive models predict future values of a time series based on the preceding values. More specifically, the user-specified lag determines how many previous timesteps it takes into account during computation, and predicted values are linear combinations of the values at each lag.
Use the following functions when training and predicting with autoregressive models. Note that these functions require datasets with consistent timesteps.
-
AUTOREGRESSOR
: trains an autoregressive model -
PREDICT_AUTOREGRESSOR
: applies the model to a dataset to make predictions
To normalize datasets with inconsistent timesteps, see Gap filling and interpolation (GFI).
Example
-
Load the datasets from the Machine-Learning-Examples repository.
This example uses the daily-min-temperatures dataset, which contains data on the daily minimum temperature in Melbourne, Australia from 1981 through 1990:
-
Use
AUTOREGRESSOR
to create the autoregressive modelAR_temperature
from thetemp_data
dataset. In this case, the model is trained with a lag ofp
=3, taking the previous 3 entries into account for each estimation:You can view a summary of the model with
GET_MODEL_SUMMARY
: -
Use
PREDICT_AUTOREGRESSOR
to predict future temperatures. The following querystart
s the prediction at the end of the dataset and returns 10 predictions.