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

pop.sim

Population simulation


Description

Simulate future sample paths of a population using functional models for mortality, fertility and migration.

Usage

pop.sim(mort, fert = NULL, mig = NULL, firstyearpop, N = 100,
  mfratio = 1.05, bootstrap = FALSE)

Arguments

mort

Forecasts of class fmforecast2 for mortality.

fert

Forecasts of class fmforecast for female fertility.

mig

Forecasts of class fmforecast2 for net migration.

firstyearpop

Population for first year of simulation.

N

Number of sample paths to simulate.

mfratio

Male-female ratio used in distributing births.

bootstrap

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

Value

A list of two arrays containing male and female future simulated population values. The arrays are of dimension (p,h,N) where p is the number of age groups, h is the forecast horizon and N is the number of simulated sample paths.

Author(s)

Rob J Hyndman

See Also

Examples

## Not run: 
require(addb)
# Construct data objects
mort.sm <- smooth.demogdata(set.upperage(extract.years(australia,1950:2002),100))
fert.sm <- smooth.demogdata(extract.years(aus.fertility,1950:2002))
aus.mig <- netmigration(set.upperage(australia,100),aus.fertility,mfratio=1.0545)
# Fit models
mort.fit <- coherentfdm(mort.sm)
fert.fit <- fdm(fert.sm)
mig.fit <- coherentfdm(aus.mig)
# Produce forecasts
mort.fcast <- forecast(mort.fit)
fert.fcast <- forecast(fert.fit)
mig.fcast <- forecast(mig.fit)
# Simulate
aus.sim <- pop.sim(mort.fcast,fert.fcast,mig.fcast,australia)
## 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.