Feed-forward neural networks with a single hidden layer and lagged inputs for forecasting univariate time series.
NNETAR(formula, size = NULL, repeats = 20, scale_inputs = TRUE, ...)
Model specification.
Number of nodes in the hidden layer. Default is half of the number of input nodes (including external regressors, if given) plus 1.
Number of networks to fit with different random starting weights. These are then averaged when producing forecasts.
If TRUE, inputs are scaled by subtracting the column means and dividing by their respective standard deviations. Scaling is applied after transformations.
Other arguments passed to nnet
.
A feed-forward neural network is fitted with lagged values of the response as
inputs and a single hidden layer with size
nodes. The inputs are for
lags 1 to p
, and lags m
to mP
where
m
is the seasonal period specified.
If exogenous regressors are provided, its columns are also used as inputs.
Missing values are currently not supported by this model.
A total of repeats
networks are
fitted, each with random starting weights. These are then averaged when
computing forecasts. The network is trained for one-step forecasting.
Multi-step forecasts are computed recursively.
For non-seasonal data, the fitted model is denoted as an NNAR(p,k) model, where k is the number of hidden nodes. This is analogous to an AR(p) model but with non-linear functions. For seasonal data, the fitted model is called an NNAR(p,P,k)[m] model, which is analogous to an ARIMA(p,0,0)(P,0,0)[m] model but with non-linear functions.