PREDICT_AUTOREGRESSOR
Applies an autoregressor (AR) model to an input relation.
Autoregressive models use previous values to make predictions. More specifically, the user-specified "lag" determines how many previous timesteps it takes into account during computation, and predicted values are linear combinations of those lags.
Syntax
PREDICT_AUTOREGRESSOR ( 'timeseries‑column'
USING PARAMETERS
model‑name = 'model-name'
[, start = starting‑index]
[, npredictions = npredictions]
[, missing = "imputation‑method" ] )
OVER (ORDER BY 'timestamp‑column')
FROM input‑relation
Note
The following argument, as written, is required and cannot be omitted nor substituted with another type of clause.
OVER (ORDER BY '<span class="code-variable">timestamp‑column</span>')
Arguments
timeseries‑column- The timeseries column used to make the prediction (only the last
pvalues, specified during model creation, are used). timestamp‑column- The timestamp column, with consistent timesteps, used to make the prediction.
input‑relation- The input relation containing the
timeseries‑columnandtimestamp‑column.Note that
input‑relationcannot have missing values in any of thep(set during training) rows precedingstart. To handle missing values, see IMPUTE or Linear interpolation.
Parameters
model_nameName of the model (case-insensitive).
start- INTEGER >p or ≤0, the index (row) of the
input‑relationat which to start the prediction. If omitted, the prediction starts at the end of theinput‑relation.If the
startindex is greater than the number of rowsNintimeseries‑column, then the values betweenNandstartare predicted and used for the prediction.If negative, the
startindex is identified by counting backwards from the end of theinput‑relation.For an
input‑relationof N rows, negative values have a lower limit of either -1000 or -(N-p), whichever is greater.Default: the end of
input‑relation npredictions- INTEGER ≥1, the number of predicted timesteps.
Default: 10
missing- One of the following methods for handling missing values:
-
drop: Missing values are ignored.
-
error: Missing values raise an error.
-
zero: Missing values are replaced with 0.
-
linear_interpolation: Missing values are replaced by linearly-interpolated values based on the nearest valid entries before and after the missing value. If all values before or after a missing value in the prediction range are missing or invalid, interpolation is impossible and the function errors.
Default: linear_interpolation
-
Examples
See Autoregressive model example.