Neural Network Time Series Forecasts
Feed-forward neural networks with a single hidden layer and lagged inputs for forecasting univariate time series.
nnetar(x, p, P=1, size, repeats=20, lambda=NULL) ## S3 method for class 'nnetar': forecast(object, h=ifelse(object$m > 1, 2 * object$m, 10), lambda=object$lambda, ...)
- a numeric vector or time series
- 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 metho
- Number of seasonal lags used as inputs.
- Number of nodes in the hidden layer. Default is half of the number of input nodes plus 1.
- Number of networks to fit with different random starting weights. These are then averaged when producing forecasts.
- Box-Cox transformation parameter.
- An object of class
- Number of periods for forecasting.
- Other arguments.
A feed-forward neural network is fitted with lagged values of
x as inputs and a single hidden layer with
size nodes. The inputs are for lags 1 to
p, and lags
m=frequency(x). 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. The fitted model is called an NNAR(p,P) model and is analogous to an ARIMA(p,0,0)(P,0,0) model but with nonlinear functions.
nnetarreturns an object of class "
forecast.nnetarreturns an object of class "
summaryis used to obtain and print a summary of the results, while the function
plotproduces a plot of the forecasts.
The generic accessor functions
residualsextract useful features of the value returned by
An object of class
"forecast"is a list containing at least the following elements:
model A list containing information about the fitted model method The name of the forecasting method as a character string mean Point forecasts as a time series x The original time series (either
objectitself or the time series used to create the model stored as
residuals Residuals from the fitted model. That is x minus fitted values. fitted Fitted values (one-step forecasts) ... Other arguments
fit <- nnetar(lynx) fcast <- forecast(fit) plot(fcast)