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

life.expectancy

Estimate life expectancy from mortality rates


Description

All three functions estimate life expectancy from lifetable. The function flife.expectancy is primarily designed for forecast life expectancies and will optionally produce prediction intervals. Where appropriate, it will package the results as a forecast object which makes it much easier to product nice plots of forecast life expectancies. The e0 function is a shorthand wrapper for flife.expectancy with age=0.

Usage

life.expectancy(data, series = names(data$rate)[1], years = data$year,
  type = c("period", "cohort"), age = min(data$age),
  max.age = min(100, max(data$age)))

flife.expectancy(data, series = NULL, years = data$year,
  type = c("period", "cohort"), age, max.age = NULL, PI = FALSE,
  nsim = 500, ...)

e0(data, series = NULL, years = data$year, type = c("period",
  "cohort"), max.age = NULL, PI = FALSE, nsim = 500, ...)

Arguments

data

Demogdata object of type “mortality” such as obtained from read.demogdata, or an object of class fmforecast such as the output from forecast.fdm or forecast.lca, or an object of class fmforecast2 such as the output from forecast.fdmpr.

series

Name of mortality series to use. Default is the first demogdata series in data.

years

Vector indicating which years to use.

type

Either period or cohort.

age

Age at which life expectancy is to be calculated.

max.age

Maximum age for life table calculation.

PI

If TRUE, produce a prediction interval.

nsim

Number of simulations to use when computing a prediction interval.

...

Other arguments passed to simulate when producing prediction intervals.

Value

Time series of life expectancies (one per year), or a forecast object of life expectancies (one per year).

Author(s)

Rob J Hyndman

See Also

Examples

plot(life.expectancy(fr.mort),ylab="Life expectancy")

france.LC <- lca(fr.mort,adjust="e0",years=1950:1997)
france.fcast <- forecast(france.LC,jumpchoice="actual")
france.e0.f <- life.expectancy(france.fcast)

france.fdm <- fdm(extract.years(fr.mort,years=1950:2006))
france.fcast <- forecast(france.fdm)
## Not run: 
  e0.fcast <- e0(france.fcast,PI=TRUE,nsim=200)
  plot(e0.fcast)
## End(Not run)

life.expectancy(fr.mort,type='cohort',age=50)

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.