r.age: Randow draws of ages

View source: R/r.age.r

r.ageR Documentation

Randow draws of ages

Description

Randow draws of ages

Usage

r.age(n, S)

Arguments

n

number of draws

S

numeric vector giving the survival function

Details

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.

Value

A vector of n random draws.

Examples

# 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)

HervePerdry/M1SP documentation built on April 4, 2023, 9:51 a.m.