View source: R/forecast_tools.R

forecast_sim | R Documentation |

Creating different forecast paths for forecast objects (when applicable),
by utilizing the underline model distribution with the `simulate`

function

```
forecast_sim(model, h, n, sim_color = "blue", opacity = 0.05,
plot = TRUE)
```

`model` |
A forecasting model supporting |

`h` |
An integer, defines the forecast horizon |

`n` |
An integer, set the number of iterations of the simulation |

`sim_color` |
Set the color of the simulation paths lines |

`opacity` |
Set the opacity level of the simulation path lines |

`plot` |
Logical, if TRUE will desplay the output plot |

The baseline series, the simulated values and a plot

```
## Not run:
library(forecast)
data(USgas)
# Create a model
fit <- auto.arima(USgas)
# Simulate 100 possible forecast path, with horizon of 60 months
forecast_sim(model = fit, h = 60, n = 100)
## End(Not run)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.