Lifespan {VirtualPop} | R Documentation |
Uses age-specific death rates to simulate length of life. The function generates age(s) at death and date(s) of death. The function uses the function rpexp() of the msm package and uniroot() of base R
Lifespan(data, ASDR, mort = NULL)
data |
Data frame with individual data. If the object "data" includes date of birth (bdated; decimal date), then the date of death is computed. |
ASDR |
Age-specific death rates |
mort |
Presence or absence of mortality. This parameter is optional. Default is TRUE. If mortality is (should be) absent, mort=FALSE. |
LS |
Data frame with age(s) at death and date(s) of death |
utils::data(dLH,package="VirtualPop")
utils::data(rates,package="VirtualPop")
d <- VirtualPop::Lifespan (dLH[1:5,1:5],ASDR=rates$ASDR)