r.age | R Documentation |
Randow draws of ages
r.age(n, S)
n |
number of draws |
S |
numeric vector giving the survival function |
The vector S
gives the survival function.
Specifically, S[i] = P(T > i-1)
; S
must be decreasing. If S[1] = 1
, P(T > 0) = 1
and
all draws are positive.
A vector of n
random draws.
# A survival function obtained from Halley's table
P <- c(Halley$number,18,16,14,13,11,9,8,6,5,3,2,1,1)
S <- c(1, P/1238)
A <- r.age(1e4, S)
mean(A)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.