SampleRandAge {paramDemo}R Documentation

Sampling Ages at Death from a Parametric Mortality model

Description

SampleRandAge is used to randomly sample ages at death from a parametric mortality model

Usage

SampleRandAge(n, theta, dx = 0.001, model = "GO", 
               shape = "simple",  minSx = 1e-04)

Arguments

n

Number of individual ages at death to sample

theta

Numerical vector of age-specific mortality parameters (see details).

dx

Numeric value for the age increments (see details).

model

The underlying mortality model to be used. "EX" = exponential,"GO" = Gompertz, "WE" = Weibull and "LO" = logistic (see details).

shape

The overall shape of the model. Values are: simple = no extra parameters added; Makeham = a constant parameter is added to the mortality; and bathtub = a Gompertz declining mortality for early ages and a constant parameter are added to the mortality model (see details).

minSx

Minimum value for the survival function to set the maximum age (see details)

Details

SampleRandAge arguments “model” and “shape”, to calculate the survival function, S(x) for x \geq 0, at discrete age intervals [x, x + \Delta x) where \Delta x is specfied with argument “dx”. It then calculates the CDF of ages at death, F(x), and uses inverse sampling to sample n ages at death by random sampling from a uniform distribution bound as

u_i \sim Unif[F(x_m), F(x_M)],

where x_m = min(x) and x_M = max(x). It then finds the corresponding ages at death as

x_i = F^{-1}(u_i).

In most cases, this is acheived numerically and thus the lower the value for argument “dx” the higher the precision.

Value

SampleRandAge returns a vector of class “numeric” with randmly generated ages at death.

Author(s)

Fernando Colchero fernando_colchero@eva.mpg.de

Examples

# Simulate age at death data from Gompertz model:
ages <- SampleRandAge(n = 100, theta = c(b0 = -5, b1 = 0.1))

# Simulate age at death data from Siler model:
ages <- SampleRandAge(n = 100, theta = c(a0 = 0, a1 = 1, c = 0.001, 
                      b0 = -5, b1 = 0.1), model = "GO", 
                      shape = "bathtub")


[Package paramDemo version 1.0.1 Index]