Anyone’s got a quick short educational example how to use neural networks (

`nnet`

in R for example) for the purpose of prediction?Here is an example, in R, of a time series

`T <- seq(0,20,length=200) Y <- 1 + 3*cos(4*T+2) +.2*T^2 + rnorm(200) plot(T,Y,type="l")`

This just an example but what I have is jumpy-seasonal data.

**Answer**

Rob Hyndman is doing some active research on forecasting with nueral nets. He recently added the `nnetar()`

function to the `forecast`

package that utilizes the `nnet`

package you reference to fit to time series data.

http://cran.r-project.org/web/packages/forecast/index.html

The example from the help docs:

```
fit <- nnetar(lynx)
fcast <- forecast(fit)
plot(fcast)
```

Rob gives more context in this specific section of his online text: Forecasting: principles and practice.

(And a big thanks to Rob obviously.)

**Attribution***Source : Link , Question Author : dfhgfh , Answer Author : Shea Parkes*