Time Series Forecasts with a user-defined model
Experimental function to forecast univariate time series with a user-defined model
modelAR( y, p, P = 1, FUN, predict.FUN, xreg = NULL, lambda = NULL, model = NULL, subset = NULL, scale.inputs = FALSE, x = y, ... )
A numeric vector or time series of class
Embedding dimension for non-seasonal time series. Number of non-seasonal lags used as inputs. For non-seasonal time series, the default is the optimal number of lags (according to the AIC) for a linear AR(p) model. For seasonal time series, the same method is used but applied to seasonally adjusted data (from an stl decomposition).
Number of seasonal lags used as inputs.
Function used for model fitting. Must accept argument
yfor the predictors and response, respectively (
formulaobject not currently supported).
Prediction function used to apply
FUNto new data. Must accept an object of class
FUNas its first argument, and a data frame or matrix of new data for its second argument. Additionally, it should return fitted values when new data is omitted.
Optionally, a vector or matrix of external regressors, which must have the same number of rows as
y. Must be numeric.
Box-Cox transformation parameter. If
lambda="auto", then a transformation is automatically selected using
BoxCox.lambda. The transformation is ignored if NULL. Otherwise, data transformed before model is estimated.
Output from a previous call to
nnetar. If model is passed, this same model is fitted to
ywithout re-estimating any parameters.
Optional vector specifying a subset of observations to be used in the fit. Can be an integer index vector or a logical vector the same length as
y. All observations are used by default.
If TRUE, inputs are scaled by subtracting the column means and dividing by their respective standard deviations. If
NULL, scaling is applied after Box-Cox transformation.
Deprecated. Included for backwards compatibility.
Other arguments passed to
This is an experimental function and only recommended for advanced users.
The selected model is fitted with lagged values of
inputs. The inputs are for
lags 1 to
p, and lags
xreg is provided, its columns are also
used as inputs. If there are missing values in
xreg, the corresponding rows (and any others which depend on them as
lags) are omitted from the fit. The model is trained for one-step
forecasting. Multi-step forecasts are computed recursively.
Returns an object of class "
summary is used to obtain and print a summary of the
The generic accessor functions
extract useful features of the value returned by
A list containing information about the fitted model
The name of the forecasting method as a character string
The original time series.
The external regressors used in fitting (if given).
Residuals from the fitted model. That is x minus fitted values.
Fitted values (one-step forecasts)