Neural networks for forecasting

Neural networks can also be used to generate forecasts for a time series variable. There is a library called forecast in R that deploys feed-forward neural networks with a single hidden layer, and lagged inputs for forecasting univariate time series. For the forecasting example, we have taken an inbuilt dataset available in R called "Air Passengers" to apply the neural network.

The following table reflects the parameter arguments required by the nnetar function with the corresponding description of how they are being used in the model:

X

Univariate time series with a time variable

p

Number of non-seasonal lags used as input

P

Number of seasonal lags used as input

Size

Number of nodes in the hidden layer

Repeats

Number of networks to fit with different random settings of weights

Lambda

This is known as box-cox transformation parameter

Xreg

External regressors used in fitting the model

Mean

Point forecasts as mean

The actual time series looks as follows:

Neural networks for forecasting

> fit<-nnetar(AirPassengers, p=9,P=,size = 10, repeats = 50,lambda = 0)
> plot(forecast(fit,10))

A neural-network-based forecasting model generates the following results as an output:

> summary(fit)

Length Class Mode

x 144 ts numeric

m 1 -none- numeric

p 1 -none- numeric

P 1 -none- numeric

scale 1 -none- numeric

size 1 -none- numeric

lambda 1 -none- numeric

model 50 nnetarmodels list

fitted 144 ts numeric

residuals 144 ts numeric

lags 10 -none- numeric

series 1 -none- character

method 1 -none- character

call 6 -none- call

With a forecast of the next 10 periods, the graph looks as follows:

Neural networks for forecasting

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.107.210