| life.expectancy {demography} | R Documentation |
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 |
series |
Name of mortality series to use. Default is the first demogdata series in data. |
years |
Vector indicating which years to use. |
type |
Either |
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 |
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)