
This function returns random samples from the time until death (future lifetime) of a subject aged x. Either the continuous or the curtate time until death can be returned.
rLife(n, object, x = 0, k=1, type = "Tx")
Number of variates to generate.
An object of class lifetable.
The attained age of subject x. Default value is 0.
Number of periods within the year when it is possible death to happen. Default value is 1.
Either "Tx" for continuous future lifetime or "Kx" for curtate future lifetime
A numeric vector of n elements.
The function is provided as is, without any warranty regarding the accuracy of calculations. The author disclaims any liability for eventual losses arising from direct or indirect use of this software.
Following relation holds for the future life time:
Actuarial Mathematics (Second Edition), 1997, by Bowers, N.L., Gerber, H.U., Hickman, J.C., Jones, D.A. and Nesbitt, C.J.
'>lifetable
, exn
# NOT RUN {
##get 20000 random future lifetimes for the Soa life table at birth
data(soa08Act)
lifes=rLife(n=20000,object=soa08Act, x=0, type="Tx")
##check if the expected life at birth derived from the life table
##is statistically equal to the expected value of the sample
#
t.test(x=lifes, mu=exn(soa08Act, x=0, type="continuous"))
# }
Run the code above in your browser using DataLab