Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

simulate.fmforecast

Simulate future sample paths from functional demographic model forecasts.


Description

This function will simulate future sample paths given forecasting models from a functional demographic model such as those obtained using forecast.fdm or forecast.fdmpr.

Usage

## S3 method for class 'fmforecast'
simulate(object, nsim = 100, seed = NULL,
  bootstrap = FALSE, adjust.modelvar = TRUE, ...)

## S3 method for class 'fmforecast2'
simulate(object, ...)

Arguments

object

Object of class fmforecast. Typically, this is output from forecast.fdm.

nsim

Number of sample paths to simulate.

seed

Either NULL or an integer that will be used in a call to set.seed before simulating the time seriers. The default, NULL will not change the random generator state.

bootstrap

If TRUE, simulation uses resampled errors rather than normally distributed errors.

adjust.modelvar

If TRUE, will adjust the model variance by the ratio of the empirical and theoretical variances for one-step forecasts.

...

Other arguments passed to simulate.fmforecast.

Value

An array containing the future simulated values (in the case of a fmforecast object), or a list of arrays containing the future simulated values (in the case of a fmforecast2 object).

Author(s)

Rob J Hyndman

See Also

Examples

## Not run: 
france.fit <- fdm(fr.mort,order=2)
france.fcast <- forecast(france.fit,50,method="ets")
france.sim <- simulate(france.fcast,nsim=100)

france.fit2 <- coherentfdm(fr.sm)
france.fcast2 <- forecast(france.fit2,50)
france.sim2 <- simulate(france.fcast2,nsim=100)
## End(Not run)

demography

Forecasting Mortality, Fertility, Migration and Population Data

v1.22
GPL (>= 2)
Authors
Rob J Hyndman with contributions from Heather Booth, Leonie Tickle and John Maindonald.
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.