Package 'paramDemo'

Title: Parametric and Non-Parametric Demographic Functions and Applications
Description: Calculate parametric mortality and Fertility models, following packages 'BaSTA' in Colchero, Jones and Rebke (2012) <doi:10.1111/j.2041-210X.2012.00186.x> and 'BaFTA' <https://github.com/fercol/BaFTA>, summary statistics (e.g. ageing rates, life expectancy, lifespan equality, etc.), life table and product limit estimators from census data.
Authors: Fernando Colchero [aut, cre]
Maintainer: Fernando Colchero <[email protected]>
License: GPL
Version: 1.0.2
Built: 2025-02-15 06:10:14 UTC
Source: https://github.com/fercol/paramdemo

Help Index


Parametric and Non-Parametric Demographic Functions and Applications

Description

Functions for parametric and non-parametric calculations of survival, mortality and fertility

Details

Package: paramDemo
Type: Package
Version: 1.0.2
Date: 2025-01-16
License: GNU General Public Licence
LazyLoad: yes

This package contains functions for calculations of parametric mortality, survival and fertility models, as well as non-parametric methods for life tables and product limit estimators.

Author(s)

Fernando Colchero [email protected]


Calculating actuarial and reproduction aging rates.

Description

CalcAgeingRateMort and CalcAgeingRateFert are used to calculate actuarial and reproductive ageing rates from parametric models of mortality and fertility.

Usage

CalcAgeingRateMort(theta, x, model = "GO", shape = "simple", 
                   checkTheta = TRUE)

CalcAgeingRateFert(beta, x, modelFert = "quadratic", ageMatur = 0,
                   checkBeta = TRUE)

Arguments

theta

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

beta

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

x

Numerical vector of ages at which to calculate mortality.

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

modelFert

Age-specific fertility model. Options are “quadratic” (default), “PeristeraKostaki”, “ColcheroMuller”, “Hadwiger”, “gamma”, “beta”, “skewNormal”, “gammaMixture”, “HadwigerMixture”, “skewSymmetric”, “skewLogistic” (see details)

ageMatur

Numerical value for the age at sexual maturity.

checkTheta

Logical to verify that the theta parameters conform with the mortality model's specification (see details).

checkBeta

Logical to verify that the beta parameters conform with the fertility model's specification (see details).

Details

The function CalcAgeingRateMort uses parametric functions to calculate the actuarial (i.e., mortality) rate of ageing. The function follows the conventions from package BaSTA (Colchero and Clark 2012, Colchero et al. 2012, Colchero et al. 2021) to select the parametric model of mortality. The mortality function describes how the risk of mortality changes with age, and is defined as

μ(xθ)=limΔx0Pr[x<X<x+ΔxX>x]Δx,\mu(x | \theta) = \lim_{\Delta x \rightarrow 0} \frac{\Pr[x < X < x + \Delta x | X > x]}{\Delta x},

where XX is a random variable for ages at death, x0x \geq 0 are ages and θ\theta is the vector of mortality parameters. (For further details on the mortality and survival models see CalcMort).

Given a vector of ages x1,x2,,xnx_1, x_2, \dots, x_n specified by the user with argument x, the function calculates ageing rates at age xix_i as

ddxln[μ(x)]x=xi,\frac{d}{dx}\ln [\mu(x)] |_{x = x_i},

for i=1,2,,ni = 1, 2, \dots, n.

Similarly, function CalcAgeingRatesFert calculate reproductive ageing rates from parametric models of age-specific fertility, g(x)g(x). It uses a numerical approximation to

ddxln[g(x)]x=xi,\frac{d}{dx}\ln [g(x)] |_{x = x_i},

for i=1,2,,ni = 1, 2, \dots, n.

Value

The functions output a matrix with the ages at which ageing rates were calculated, the estimated actuarial rate of ageing, and the level of survival at that age.

Author(s)

Fernando Colchero [email protected]

See Also

CalcSurv to calculate age-specific survival, CalcMort to calculate age-specific mortality, CalcFert to calculate age-specific fertility.

CalcAgeMaxFert to calculate the age at maximum fertility from parametric models of age-specific fertility. CalcRemainLifeExp to calculate remaining life expectancy from parametric models of age-specific mortality.

Examples

# Calculate actuarial ageing rate from Gompertz model:
arm <- CalcAgeingRateMort(theta = c(b0 = -5, b1 = 0.1), x = 10)

# Calculate reproductive ageing rate from quadratic model:
arf <- CalcAgeingRateFert(beta = c(b0 = 2, b1 = 0.0025, b2 = 2), x = 10,
                          modelFert = "quadratic")

Calculating Age at Maximum Fertility and Maximum Fertility.

Description

CalcAgeMaxFert is used to calculate the age at maximum fertility, and the maximum fertility level from parametric models of fertility.

Usage

CalcAgeMaxFert (beta, modelFert = "quadratic", ageMatur = 0, 
                           maxAge = 100)

Arguments

beta

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

modelFert

Age-specific fertility model. Options are “quadratic” (default), “PeristeraKostaki”, “ColcheroMuller”, “Hadwiger”, “gamma”, “beta”, “skewNormal”, “gammaMixture”, “HadwigerMixture”, “skewSymmetric”, “skewLogistic” (see details)

ageMatur

Numerical value for the age at sexual maturity.

maxAge

Numerical value for the maximum possible age of reproduction.

Details

For a given function gg of age-specific fertility, CalcAgeMaxFert uses either an analytical solution to

dgdx=0\frac{dg}{dx} = 0

or a numerical approximation. For details of the parametric models available see CalcFert.

Value

The function outputs a vector with the calculated or estimated age at maximum fertility, the maximum level of fertility, the error in the estimation and the number of iterations (for numerical approximations), and the age at maturity as specified by the user.

Author(s)

Fernando Colchero [email protected]

See Also

CalcSurv to calculate age-specific survival, CalcMort to calculate age-specific mortality, CalcFert to calculate age-specific fertility.

CalcAgeingRateMort to calculate ageing rates from parametric models of age-specific mortality. CalcRemainLifeExp to calculate remaining life expectancy from parametric models of age-specific mortality.

Examples

# Calculate age at maximum fertility from quadratic model:
maxg <- CalcAgeMaxFert(beta = c(b0 = 0.5, b1 = 0.01, b2 = 10))

# Calculate age at maximum fertility from gamma model:
maxg <- CalcAgeMaxFert(beta = c(b0 = 13, b1 = 2, b2 = 0.15),
                     modelFert = "gamma")

Calculating Parametric Age-Specific Mortality, Survival, and Fertility

Description

CalcDemo is used to calculate age-specific demographic rates and summary statistics from parametric models of survival and fertility.

Usage

CalcDemo(theta = NULL, beta = NULL, x = NULL, dx = NULL, 
          model = "GO",  shape = "simple", modelFert = "quadratic", 
          type = "both", minSx = 0.01,  summarStats = TRUE, 
          ageMatur = 0, maxAge = NULL, agesAR = NULL,  
          SxValsAR = NULL)

Arguments

theta

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

beta

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

x

Numerical vector of ages. If NULL (default), ages are constructed from age 0 to the age when the survival function reaches 0.0001.

dx

Numerical value for age increments. If NULL, the default value is 0.01.

model

Mortality model, options are “EX” = exponential (i.e., constant mortality with age), “GO” = Gompertz (default), “WE” = Weibull, or “LO” = logistic.

shape

The overall shape of the mortality 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).

modelFert

Age-specific fertility model. Options are “quadratic” (default), “PeristeraKostaki”, “ColcheroMuller”, “Hadwiger”, “gamma”, “beta”, “skewNormal”, “gammaMixture”, “HadwigerMixture”, “skewSymmetric”, “skewLogistic” (see details)

type

Character string specifying the demographic rates to be calculated. Options are “both” (default), “survival”, “fertility”.

minSx

Numerical value specifying the lower bound of the survival function to find the maximum age. The default is 0.01.

summarStats

Logical specifying whether summary statistics such as life expectancy, lifespan equality and ageing rates at the specified ages should be calculated.

ageMatur

Numerical value specifying the age at sexual maturity, used as the lower bound for the age-specific fertility. Default is 0.

maxAge

Numerical values for the maximum age for survival and fertility demographic rates. If NULL (default), the maximum age is calculated when the survival function reaches minSx.

agesAR

Numerical vector of ages at which ageing rates should be calculated. If NULL (default) they are calculated at the ages when the survival function reaches 0.5, 0.2, and 0.05.

SxValsAR

Alternative to agesAR, numerical value for the levels of survival at which ageing rates should be calculated. If NULL (default) they are calculated at the ages when the survival function reaches 0.5, 0.2, and 0.05.

Details

1) Age-specific mortality and survival models:

The function CalcDemo uses parametric functions to calculate age-specific survival, defined as the probability of surviving to a given age. The function follows the conventions from package BaSTA (Colchero and Clark 2012, Colchero et al. 2012, Colchero et al. 2021). The mortality function describes how the risk of mortality changes with age, and is defined as

μ(xθ)=limΔx0Pr[x<X<x+ΔxX>x]Δx,\mu(x | \theta) = \lim_{\Delta x \rightarrow 0} \frac{\Pr[x < X < x + \Delta x | X > x]}{\Delta x},

where XX is a random variable for ages at death, x0x \geq 0 are ages and θ\theta is the vector of mortality parameters. From the mortality function, the survival function is then given by

S(xθ)=exp[0xμ(tθ)dt].S(x | \bm{\theta}) = \exp[-\int_0^x \mu(t | \bm{\theta}) dt].

1.1)Argument model:

The model argument allows the user to choose between four basic mortality functions, namely

(a) model = EX”: The exponential model (Cox and Oakes 1974), with constant mortality with age, specified as

μb(xθ)=b,\mu_b(x | \bm{\theta}) = b,

where b>0b > 0, with survival

Sb(xθ)=exp[bx].S_b(x | \bm{\theta}) = \exp[-b x].

(b) model = GO”: The Gompertz mortality model (Gompertz 1925, Pletcher 1999), calculated as

μb(xθ)=exp(b0+b1x),\mu_b(x | \bm{\theta}) = \exp(b_0 + b_1 x),

where <b0,b1<-\infty < b_0, b_1 < \infty, with survival

Sb(xθ)=exp[eb0b1(1eb1x)].S_b(x | \bm{\theta}) = \exp\left[\frac{e^{b_0}}{b_1}\left(1 - e^{b_1 x}\right)\right].

(c) model = WE”: The Weibull mortality model (Pinder III et al. 1978) calculated as

μb(xθ)=b0b1b0xb01,\mu_b(x | \bm{\theta}) = b_0 b_1^{b_0} x^{b_0 -1},

where b0,b1>0b_0, b_1 > 0, with survival

Sb(xθ)=exp[(b1x)b0].S_b(x | \bm{\theta}) = \exp\left[-(b_1 x)^{b_0}\right].

(d) model = LO”: The logistic mortality model (Pletcher 1999), calculated as

μb(xθ)=exp(b0+b1x)1+b2eb0b1(eb1x1),\mu_b(x | \bm{\theta}) = \frac{\exp(b_0 + b_1 x)}{1 + b_2 \frac{e^{b_0}}{b_1} \left(e^{b_1 x}-1\right)},

where b0,b1,b2>0b_0, b_1, b_2 > 0, with survival

Sb(xθ)=[1+b2eb0b1(eb1x1)]1/b2.S_b(x | \bm{\theta}) = \left[1 + b_2 \frac{e^{b_0}}{b_1} \left(e^{b_1 x} - 1\right)\right]^{-1 / b_2}.

1.2)Argument shape:

The shape argument allows the user to extend these models in order to explore more complex mortality shapes.

(a) shape = simple”: (default) Leaves the model as defined above, with mortality given by

μ(xθ)=μb(xθ)\mu(x | \bm{\theta}) = \mu_b(x | \bm{\theta})

and survival

S(xθ)=Sb(xθ.S(x | \bm{\theta}) = S_b(x | \bm{\theta}.

(b) shape = Makeham”: A constant is added to the mortality, such that the mortality is given by

μ(xθ)=c+μb(xθ1),\mu(x | \bm{\theta}) = c + \mu_b(x | \bm{\theta}_1),

where θ=[c,θ1]\bm{\theta} = [c, \bm{\theta}_1], and with survival

S(xθ)=ecxSb(xθ1)S(x | \bm{\theta}) = e^{-cx} S_b(x | \bm{\theta}_1)

The most common models with this shape is the Gompertz-Makeham model (Gompertz 1825, Makeham 1866).

(c) shape = bathtub”: produces a concave shapes in mortality by adding a declining Gompertz term and a constant parameter to the basic mortality model, where the mortality function is

μ(xθ)=exp(a0a1x)+c+μb(xθ1),\mu(x | \bm{\theta}) = \exp(a_0 - a_1 x) + c + \mu_b(x | \bm{\theta}_1),

where a0Ra_0 \in \mathbb{R}, a1,c0a_1, c \geq 0 and θ1θ\bm{\theta}_1 \subset \bm{\theta} are specified based on argument model, and with survival

S(xθ)=exp[ea0a1(ea1x1)cx]Sb(xθ1).S(x | \theta) = \exp\left[\frac{e^{a_0}}{a_1}\left(e^{a_1 x} - 1\right)-cx\right] S_b(x | \theta_1).

The most widely use “bathtub” shaped model is the Siler mortality model (Siler 1979), which provides considerably good fits to mammalian data. The arguments for the Siler model are:

CalcDemo(..., model = "GO", shape = "bathtub", ...)

2) Specifying theta parameters:

Argument theta requires a numerical vector of parameters. For instance, for a Gompertz model with simple shape and with parameter vector θ=[b0,b1]\bm{\theta}^{\top} = [b_0, b_1] where b0=5b_0 = -5 and b1=0.1b_1 = 0.1, the argument should be specified as

CalcDemo(theta = c(b0 = -5, b1 = 0.1), ...)

Note that in this example the parameter names are specified directly, this is required when checkTheta = FALSE. Although assigning the names to each parameter is not necessary when checkTheta = TRUE, it is advisable to ensure that the right values are assigned to the right parameter.

If argument checkTheta is set to TRUE, then the vector of theta parameters is verified for consistency with the requirements of the model and shape selected.

3) Age-specific fertility models:

The age-specific fertility models correspond to the expected number of offspring produced by adults of a given age. Therefore, for a random variable YxY_{x} with realizations yxy_x for the number of offspring produced by adults of age xx, we have that E(Yx)=g(xβ)E(Y_x) = g(x | \bm{\beta}), where g:R0R0g: \mathbb{R}_{\ge 0} \rightarrow \mathbb{R}_{\ge 0} is a non-negative smooth fertility function and β\bm{\beta} is a vector of parameters to be estimated. The functional forms of function gg fall in two main categories, namely polynomial and distributional models.

3.a) Polynomial:

Of the models available in paramDemo, the “quadratic”, “PeristeraKostaki” (Peristera and Kostaki 2007), and “ColcheroMuller” (Colchero et al. 2021, Muller et al. 2020) fall within the polynomial category. Both, the “PeristeraKostaki” and “ColcheroMuller” are non-symmetric around the age at maximum fertility.

3.b) Distributional:

The distributional models are of the form

g(xβ)=Rf(xβ1),g(x | \bm{\beta}) = R f(x | \bm{\beta}_1),

where f:R0R0f: \mathbb{R}_{\ge 0} \rightarrow \mathbb{R}_{\ge 0} is a probability density function, R>0R > 0 is a parameter for the total fertility rate, and β1β\bm{\beta}_1 \subset \bm{\beta} is a vector of parameters. The “Hadwiger” (Hadwiger 1940), “gamma” (Hoem et al. 1981), “beta” (Hoem et al. 1981), “skewNormal” (Mazzuco and Scarpa 2011, 2015), “gammaMixture” (Hoem et al. 1981), “HadwigerMixture” (Chandola et al. 1991), “skewSymmetric” (Mazzuco and Scarpa 2011, 2015), and “skewLogistic” (Asili et al. 2014) all fall in this category. Notably, the “gammaMixture”, “HadwigerMixture”, “skewSymmetric”, “skewLogistic” are appropriate when fertility might be bimodal (Hoem et al. 1981, Chandola et al. 1999, Mazzuco and Scarpa 2011, 2015, Asili et al. 2014).

4) Specifiying beta parameters:

Argument beta requires a vector of parameters. For instance, for a quadratic model with parameter vector β=[b0,b1,b2]\bm{\beta}^{\top} = [b_0, b_1, b_2] where b0=0.5b_0 = 0.5, b1=0.01b_1 = 0.01 and b2=10b_2 = 10, the argument should be specified as

CalcDemo(..., beta = c(b0 = 0.5, b1 = 0.01, b2 = 10), ...)

Note that in this example the parameter names are specified directly, this is required when checkBeta = FALSE. Although assigning the names to each parameter is not necessary when checkBeta = TRUE, it is advisable to ensure that the right values are assigned to the right parameter.

If argument checkBeta is set to TRUE, then the vector of beta parameters is verified for consistency with the requirements of the fertility model selected.

5) Summary statistics:

5.1) Ageing rates:

Given a vector of ages x1,x2,,xnx_1, x_2, \dots, x_n specified by the user with argument agesAR, the function calculates ageing rates at age xix_i as

ddxln[μ(x)]x=xi,\frac{d}{dx}\ln [\mu(x)] |_{x = x_i},

for i=1,2,,ni = 1, 2, \dots, n.

5.2) Ages at different levels of survival:

The function calculates the ages when the survival function reaches specific values(default at 0.2, 0.1, 0.05), commonly used as population measures of old age. Thus, for a given value s=S(x)s = S(x), the function computes the inverse function

x=S1(s).x = S^{-1}(s).

5.3) Remaining life expectancy:

The function calculates the life expectancy at birth as

e0=0S(t)dt.e_{0} = \int_{0}^{\infty} S(t) dt.

5.4) Measures of inequality and equality:

The function calculates different measures of inequality and equality in the distribution of ages at death that results from the parametric model:

- Lifespan inequality: (Demetrius 1974, Keyfitz and Caswell 2005) given by

H=0S(x)ln[S(x)]dxe0H = -\frac{\int_{0}^{\infty} S(x) \ln [S(x)] dx}{e_0}

- Lifespan equality: (Colchero et al. 2016, Colchero et al. 2021) given by

ε=lnH.\varepsilon = - \ln H.

- Gini coefficient: (Gini 1912, Shkolnikov et al. 2003) given by

G=11e00[l(x)]2dxG = 1 - \frac{1}{e_0} \int_0^{\infty} [l(x)]^2 dx

- Coefficient of variation: given by

CV=σ2e0,CV = \frac{\sqrt{\sigma^2}}{e_0},

where σ2\sigma^2 is the variance in ages at death.

Value

CalcDemo returns an object of class “paramDemo” with output consisting of two lists, one for survival and one for fertility. The survival list can be called as object$surv while the fertility list is in object$fert. Both include the following outputs:

functs

data.frame including the follwing columns for survival: age, mort for the mortality function, surv for the survival, pdf for the probability density function of ages at death, and cumhaz for the cumulative hazards. For fertility it includes columns for age and fert for the age-specific fertility.

summStats

list with elements: calculated indicating whether summary statistics were calculated, ageingRates with the resulting actuarial ageing rates, and summStatsMort with ages at which the survival function reaches different levels (default 0.5, 0.2, 0.05) (e.g., AgeSx=0.5), with the life expectancy lifeExp, lifespIneq for the lifespan inequality (see Demetrius 1974), lifespEqual with the lifespan equality as in Colchero et al. (2021), Gini for the Gini coefficient, and CoeffVar for the coefficient of variation in the distribution of ages at death. For fertility, the list includes a logical calculated to indicate if summary statistics were calculated, and summStatsFert with the age at maximum fertility calculations (see CalcAgeMaxFert).

settings

list with the details of the parameters and the models used.

analyzed

logical indicating whether surv or fert were calculated.

Author(s)

Fernando Colchero [email protected]

References

Asili S., Rezaei S., Najjar, L. (2014) Using Skew-Logistic Probability Density Function as a Model for Age-Specific Fertility Rate Pattern. BioMed Research International, 2014, 790294.

Azzalini, A. (1985) A Class of Distributions Which Includes the Normal Ones. Scandinavian Journal of Statistics, 2, 171-178.

Chandola, T., Coleman D.A., Hiorns R.W. (1999) Recent European fertility patterns: Fitting curves to ‘distorted’ distributions. Population Studies, 53, 317-329.

Colchero, F. (In prep.) Inference on age-specific fertility in ecology and evolution. Learning from other disciplines and improving the state of the art.

Colchero, F., Eckardt, W., Stoinski, T. (2021) Evidence of demographic buffering in an endangered great ape: Social buffering on immature survival and the role of refined sex-age classes on population growth rate. Journal of Animal Ecology, 90, 1701-1713.

Colchero, F., J.S. Clark (2012) Bayesian inference on age-specific survival from capture-recapture data for censored and truncated data. Journal of Animal Ecology. 81, 139-149.

Colchero, F., O.R. Jones, M. Rebke. (2012) BaSTA: an R package for Bayesian estimation of age-specific survival from incomplete mark-recapture/recovery data with covariates. Method in Ecology and Evolution. 3, 466-470.

Colchero, F., et al. (2021) The long lives of primates and the “invariant rate of aging” hypothesis. Nature Communications 12:3666

Cox, D. R., and Oakes D. (1984) Analysis of Survival Data. Chapman and Hall, London.

Demetrius, L. (1974) Demographic parameters and natural selection. PNAS 71, 4645-4647.

Gompertz, B. (1825) On the nature of the function expressive of the law of human mortality, and on a new mode of determining the value of life contingencies. Philosophical Transactions of the Royal Society of London, 115, 513-583.

Hadwiger, H. (1940) Eine analytische Reproduktionssunktion fur biologische Gesamtheiten. Scandinavian Actuarial Journal, 1940, 101-113.

Hoem, J.M., Madien, D., Nielsen, J.L., Ohlsen, E.M., Hansen, H.O., Rennermalm, B. (1981) Experiments in modelling recent Danish fertility curves. Demography, 18, 231-244.

Keyfitz, N., Caswell, H. (2005) Applied Mathematical Demography. (Springer-Verlag).

Makeham, W. M. (1866) On the law of mortality Journal of the Institute of Actuaries 13, 1-34.

Mazzuco, S., Scarpa, B. (2011) Fitting age-specific fertility rates by a skew- symmetric probability density function. (Working paper 10), University of Padua.

Mazzuco, S., Scarpa, B. (2015) Fitting age-specific fertility rates by a flexible generalized skew normal probability density function. Journal of the Royal Statistical Society: Series A, 178, 187-203.

Muller M. N., Blurton Jones N. G, Colchero F., Thompson M. E., Enigk D. K. (2020) Sexual dimorphism in chimpanzee (Pan troglodytes schweinfurthii) and human age-specific fertility. Journal of human evolution, 144, 102795.

Peristera P., Kostaki A. (2007) Modeling fertility in modern populations. Demographic Research, 16, 141-194.

Pinder III, J.E., Wiener, J.G. and Smith, M.H. (1978) The Weibull distribution: a new method of summarizing survivorship data. Ecology, 59, 175-179.

Shkolnikov, V., Andreev, E., Begun, A. Z. (2003) Gini coefficient as a life table function. Demographic Research 8, 305-358.

Siler W. A (1979) competing-risk model for animal mortality. Ecology 60, 750-757.

See Also

CalcSurv to calculate age-specific survival, CalcMort to calculate age-specific mortality, CalcFert to calculate age-specific fertility.

CalcAgeingRateMort to calculate ageing rates from parametric models of age-specific mortality. CalcRemainLifeExp to calculate remaining life expectancy from parametric models of age-specific mortality. CalcAgeMaxFert to calculate the age at maximum fertility from parametric models of age-specific fertility.

CalcLifeHist to calculate life history variables from parametric demographic models.

Examples

# Create paramDemo object from Gompertz mortality and
# quadratic fertility:
dem <- CalcDemo(theta = c(b0 = -5, b1 = 0.1), 
                 beta = c(b0 = 0.5, b1 = 0.01, b2 = 10),
                 summarStats = TRUE, agesAR = c(5, 10))

# Plot demographic object:
plot(dem)

Calculating Demographic Rates on Discrete Age Intervals from Parametric Age-Specific Mortality

Description

CalcDiscrDemo is used to calculate survival and fertility functions (i.e., lx, px, and qx) on discrete age intervals from an object of class “paramDemo” created with function CalcDemo.

Usage

CalcDiscrDemo(demo, dx = 1)

Arguments

demo

Object of class “paramDemo” created with function CalcDemo

dx

Numeric value for the age increments. Default is dx = 1

Details

CalcDiscrDemo takes the continuous survival functions from an object of class “paramDemo” and calculates the basic survival probabilities and, if available, fertility rates on discrete age intervals.

Let x0x \geq 0 and ωN\omega \in \mathbb{N} be the next integer of the age when the survival function S(x)S(x) reaches the minimum. Given the age increments, Δx\Delta x, specified with argument dx, the function creates a partition of [0,ω][0, \omega] such that [xi,xi+Δx)[0,ω][x_i, x_i + \Delta x) \subset [0, \omega] for i=1,,ni = 1, \dots, n. At each age interval it calculates the discrete survival, lx, as

lxi=S(xi).l_{x_i} = S(x_i).

The age- or stage-specific survival probability, px, is calculated as

pxi=S(xi+Δx)S(xi),p_{x_i} = \frac{S(x_i + \Delta x)}{S(x_i)},

while the age- or stage-specific mortality probability, qx, is qxi=1pxiq_{x_i} = 1 - p_{x_i}.

If fertility was also calculated with function CalcDemo, then the function includes the discrete age- or stage-specific fertility, bx, as

bxi=b(xi+Δx2)Δx,b_{x_i} = b\left(x_i + \frac{\Delta x}{2}\right) \Delta x,

where b(x)b(x) is the continuous fertility function.

Value

CalcDiscrDemo returns an object of class “discrDemo” that consist of a matrix with the following columns:

age

Partition of the full age subset into discrete intervals

lx

Survival or cumulative survival

px

The age- or stage-specific survival probability

qx

The age- or stage-specific mortality probability

bx

If available, the age- or stage-specific fertility

Author(s)

Fernando Colchero [email protected]

See Also

CalcDemo to create an object of class “paramDemo”.

Examples

# Create paramDemo object from Gompertz mortality and
# quadratic fertility:
dem <- CalcDemo(theta = c(b0 = -5, b1 = 0.1), 
                 beta = c(b0 = 0.5, b1 = 0.01, b2 = 10),
                 summarStats = TRUE, agesAR = c(5, 10))

# Create discrete demographic object:
demDisc <- CalcDiscrDemo(dem, dx = 1)

Calculating Parametric Age-Specific Fertility.

Description

CalcFert is used to calculate age-specific fertility from different parametric models.

Usage

CalcFert(beta, x, modelFert = "quadratic", checkBeta = TRUE)

Arguments

beta

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

x

Numerical vector of ages at which to calculate fertility.

modelFert

Age-specific fertility model. Options are “quadratic” (default), “PeristeraKostaki”, “ColcheroMuller”, “Hadwiger”, “gamma”, “beta”, “skewNormal”, “gammaMixture”, “HadwigerMixture”, “skewSymmetric”, “skewLogistic” (see details)

checkBeta

Logical to verify that the beta parameters conform with the model's specification (see details).

Details

1) Age-specific fertility models:

The age-specific fertility models correspond to the expected number of offspring produced by adults of a given age. Therefore, for a random variable YxY_{x} with realizations yxy_x for the number of offspring produced by adults of age xx, we have that E(Yx)=g(xβ)E(Y_x) = g(x | \beta), where g:R0R0g: \mathbb{R}_{\ge 0} \rightarrow \mathbb{R}_{\ge 0} is a non-negative smooth fertility function and β\beta is a vector of parameters to be estimated. The functional forms of function gg fall in two main categories, namely polynomial and distributional models.

2.a) Polynomial:

Of the models available in paramDemo, the “quadratic”, “PeristeraKostaki” (Peristera and Kostaki 2007), and “ColcheroMuller” (Colchero et al. 2021, Muller et al. 2020) fall within the polynomial category. Both, the “PeristeraKostaki” and “ColcheroMuller” are non-symmetric around the age at maximum fertility.

2.b) Distributional:

The distributional models are of the form

g(xβ)=Rf(xβ1),g(x | \beta) = R f(x | \beta_1),

where f:R0R0f: \mathbb{R}_{\ge 0} \rightarrow \mathbb{R}_{\ge 0} is a probability density function, R>0R > 0 is a parameter for the total fertility rate, and β1β\beta_1 \in \beta is a vector of parameters. The “Hadwiger” (Hadwiger 1940), “gamma” (Hoem et al. 1981), “beta” (Hoem et al. 1981), “skewNormal” (Mazzuco and Scarpa 2011, 2015), “gammaMixture” (Hoem et al. 1981), “HadwigerMixture” (Chandola et al. 1991), “skewSymmetric” (Mazzuco and Scarpa 2011, 2015), and “skewLogistic” (Asili et al. 2014) all fall in this category. Notably, the “gammaMixture”, “HadwigerMixture”, “skewSymmetric”, “skewLogistic” are appropriate when fertility might be bimodal (Hoem et al. 1981, Chandola et al. 1999, Mazzuco and Scarpa 2011, 2015, Asili et al. 2014).

2) Specifying beta parameters:

Argument beta requires a vector of parameters. For instance, for a quadratic model with parameter vector β=[0.5,0.01,10]\beta^{\top} = [0.5, 0.01, 10], the argument should be specified as theta = c(b0 = 0.5, b1 = 0.01, b2 = 10). Note that in this example the parameter names are specified directly, this is required when checkBeta = FALSE. Although assigning the names to each parameter is not necessary when checkBeta = TRUE, it is advisable to ensure that the right values are assigned to the right parameter.

If argument checkBeta is set to TRUE, then the vector of beta parameters is verified for consistency with the requirements of the model and shape selected.

Value

CalcFert returns a vector of class “numeric” with the fertility values at the specified ages.

Author(s)

Fernando Colchero [email protected]

References

Asili, S., Rezaei, S. & Najjar, L. (2014) Using Skew-Logistic Probability Density Function as a Model for Age-Specific Fertility Rate Pattern. BioMed Research International, 2014, 790294.

Azzalini, A. (1985) A Class of Distributions Which Includes the Normal Ones. Scandinavian Journal of Statistics, 2, 171-178.

Chandola, T., Coleman, D.A. & Hiorns, R.W. (1999) Recent European fertility patterns: Fitting curves to ‘distorted’ distributions. Population Studies, 53, 317-329.

Colchero, F. (In prep.) Inference on age-specific fertility in ecology and evolution. Learning from other disciplines and improving the state of the art.

Colchero, F., Eckardt, W. & Stoinski, T. (2021) Evidence of demographic buffering in an endangered great ape: Social buffering on immature survival and the role of refined sex-age classes on population growth rate. Journal of Animal Ecology, 90, 1701-1713.

Hadwiger, H. (1940) Eine analytische Reproduktionssunktion fur biologische Gesamtheiten. Scandinavian Actuarial Journal, 1940, 101-113.

Hoem, J.M., Madien, D., Nielsen, J.L., Ohlsen, E.M., Hansen, H.O. & Rennermalm, B. (1981) Experiments in modelling recent Danish fertility curves. Demography, 18, 231-244.

Mazzuco, S. & Scarpa, B. (2011) Fitting age-specific fertility rates by a skew- symmetric probability density function. (Working paper 10), University of Padua.

Mazzuco, S. & Scarpa, B. (2015) Fitting age-specific fertility rates by a flexible generalized skew normal probability density function. Journal of the Royal Statistical Society: Series A, 178, 187-203.

Muller, M. N., Blurton Jones, N. G, Colchero, F., Thompson, M. E., Enigk, D. K. (2020) Sexual dimorphism in chimpanzee (Pan troglodytes schweinfurthii) and human age-specific fertility. Journal of human evolution, 144, 102795.

Peristera, P. & Kostaki, A. (2007) Modeling fertility in modern populations. Demographic Research, 16, 141-194.

See Also

CalcMort to calculate age-specific mortality, CalcSurv to calculate age-specific survival

Examples

# Age specific fertility based on quadratic model (default):
fert <- CalcFert(beta = c(b0 = 0.5, b1 = 0.01, b2 = 10), x = 10)

# Age specific fertility based on gamma model:
fert <- CalcFert(beta = c(b0 = 13, b1 = 2, b2 = 0.15), x = 10,
                  modelFert = "gamma")

Calculating life history variables from parametric models of age-specific demographic rates.

Description

CalcLifeHist uses parametric models of survival and fertility to calculate age-specific demographic rates, stable age structure, reproductive values, sensitivity and elasticities of the stable population growth rate to demographic rates, as well as different life history variables such as generation time or population entropy.

Usage

CalcLifeHist(theta = NULL, beta = NULL, dx = NULL,
             model = "GO", shape = "simple",
             modelFert = "quadratic", ageMatur = 0, 
             maxAge = NULL, lambdaMethod = "matrix")

Arguments

theta

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

beta

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

dx

Numerical value for the age-interval increments, default is 1.

model

Mortality model, options are “EX” = exponential (i.e., constant mortality with age), “GO” = Gompertz (default), “WE” = Weibull, or “LO” = logistic.

shape

The overall shape of the mortality 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).

modelFert

Age-specific fertility model. Options are “quadratic” (default), “PeristeraKostaki”, “ColcheroMuller”, “Hadwiger”, “gamma”, “beta”, “skewNormal”, “gammaMixture”, “HadwigerMixture”, “skewSymmetric”, “skewLogistic” (see details)

ageMatur

Numerical value for the age at maturity.

maxAge

Numerical value for the maximum age. If NULL (default), it is calculated from the survival (see details).

lambdaMethod

Character string specifying the method to calculate the intrinsic population growth rate. Values are “matrix” for methods based on population projection matrices, or “Lotka” for numerical approximation of the root of the Lotka equation (see details)

Details

1) Age-specific mortality and survival models:

The function CalcDemo uses parametric functions to calculate age-specific survival, defined as the probability of surviving to a given age. The function follows the conventions from package BaSTA (Colchero and Clark 2012, Colchero et al. 2012, Colchero et al. 2021). The mortality function describes how the risk of mortality changes with age, and is defined as

μ(xθ)=limΔx0Pr[x<X<x+ΔxX>x]Δx,\mu(x | \theta) = \lim_{\Delta x \rightarrow 0} \frac{\Pr[x < X < x + \Delta x | X > x]}{\Delta x},

where XX is a random variable for ages at death, x0x \geq 0 are ages and θ\theta is the vector of mortality parameters. From the mortality function, the survival function is then given by

S(xθ)=exp[0xμ(tθ)dt].S(x | \bm{\theta}) = \exp[-\int_0^x \mu(t | \bm{\theta}) dt].

1.1)Argument model:

The model argument allows the user to choose between four basic mortality functions, namely

(a) model = EX”: The exponential model (Cox and Oakes 1974), with constant mortality with age, specified as

μb(xθ)=b,\mu_b(x | \bm{\theta}) = b,

where b>0b > 0, with survival

Sb(xθ)=exp[bx].S_b(x | \bm{\theta}) = \exp[-b x].

(b) model = GO”: The Gompertz mortality model (Gompertz 1925, Pletcher 1999), calculated as

μb(xθ)=exp(b0+b1x),\mu_b(x | \bm{\theta}) = \exp(b_0 + b_1 x),

where <b0,b1<-\infty < b_0, b_1 < \infty, with survival

Sb(xθ)=exp[eb0b1(1eb1x)].S_b(x | \bm{\theta}) = \exp\left[\frac{e^{b_0}}{b_1}\left(1 - e^{b_1 x}\right)\right].

(c) model = WE”: The Weibull mortality model (Pinder III et al. 1978) calculated as

μb(xθ)=b0b1b0xb01,\mu_b(x | \bm{\theta}) = b_0 b_1^{b_0} x^{b_0 -1},

where b0,b1>0b_0, b_1 > 0, with survival

Sb(xθ)=exp[(b1x)b0].S_b(x | \bm{\theta}) = \exp\left[-(b_1 x)^{b_0}\right].

(d) model = LO”: The logistic mortality model (Pletcher 1999), calculated as

μb(xθ)=exp(b0+b1x)1+b2eb0b1(eb1x1),\mu_b(x | \bm{\theta}) = \frac{\exp(b_0 + b_1 x)}{1 + b_2 \frac{e^{b_0}}{b_1} \left(e^{b_1 x}-1\right)},

where b0,b1,b2>0b_0, b_1, b_2 > 0, with survival

Sb(xθ)=[1+b2eb0b1(eb1x1)]1/b2.S_b(x | \bm{\theta}) = \left[1 + b_2 \frac{e^{b_0}}{b_1} \left(e^{b_1 x} - 1\right)\right]^{-1 / b_2}.

1.2)Argument shape:

The shape argument allows the user to extend these models in order to explore more complex mortality shapes.

(a) shape = simple”: (default) Leaves the model as defined above, with mortality given by

μ(xθ)=μb(xθ)\mu(x | \bm{\theta}) = \mu_b(x | \bm{\theta})

and survival

S(xθ)=Sb(xθ.S(x | \bm{\theta}) = S_b(x | \bm{\theta}.

(b) shape = Makeham”: A constant is added to the mortality, such that the mortality is given by

μ(xθ)=c+μb(xθ1),\mu(x | \bm{\theta}) = c + \mu_b(x | \bm{\theta}_1),

where θ=[c,θ1]\bm{\theta} = [c, \bm{\theta}_1], and with survival

S(xθ)=ecxSb(xθ1)S(x | \bm{\theta}) = e^{-cx} S_b(x | \bm{\theta}_1)

The most common models with this shape is the Gompertz-Makeham model (Gompertz 1825, Makeham 1866).

(c) shape = bathtub”: produces a concave shapes in mortality by adding a declining Gompertz term and a constant parameter to the basic mortality model, where the mortality function is

μ(xθ)=exp(a0a1x)+c+μb(xθ1),\mu(x | \bm{\theta}) = \exp(a_0 - a_1 x) + c + \mu_b(x | \bm{\theta}_1),

where a0Ra_0 \in \mathbb{R}, a1,c0a_1, c \geq 0 and θ1θ\bm{\theta}_1 \subset \bm{\theta} are specified based on argument model, and with survival

S(xθ)=exp[ea0a1(ea1x1)cx]Sb(xθ1).S(x | \theta) = \exp\left[\frac{e^{a_0}}{a_1}\left(e^{a_1 x} - 1\right)-cx\right] S_b(x | \theta_1).

The most widely use “bathtub” shaped model is the Siler mortality model (Siler 1979), which provides considerably good fits to mammalian data. The arguments for the Siler model are:

CalcLifeHist(..., model = "GO", shape = "bathtub", ...)

2) Specifying theta parameters:

Argument theta requires a numerical vector of parameters. For instance, for a Gompertz model with simple shape and with parameter vector θ=[b0,b1]\bm{\theta}^{\top} = [b_0, b_1] where b0=5b_0 = -5 and b1=0.1b_1 = 0.1, the argument should be specified as

CalcDemo(theta = c(b0 = -5, b1 = 0.1), ...)

Note that in this example the parameter names are specified directly, this is required when checkTheta = FALSE. Although assigning the names to each parameter is not necessary when checkTheta = TRUE, it is advisable to ensure that the right values are assigned to the right parameter.

If argument checkTheta is set to TRUE, then the vector of theta parameters is verified for consistency with the requirements of the model and shape selected.

3) Age-specific fertility models:

The age-specific fertility models correspond to the expected number of offspring produced by adults of a given age. Therefore, for a random variable YxY_{x} with realizations yxy_x for the number of offspring produced by adults of age xx, we have that E(Yx)=g(xβ)E(Y_x) = g(x | \bm{\beta}), where g:R0R0g: \mathbb{R}_{\ge 0} \rightarrow \mathbb{R}_{\ge 0} is a non-negative smooth fertility function and β\bm{\beta} is a vector of parameters to be estimated. The functional forms of function gg fall in two main categories, namely polynomial and distributional models.

3.a) Polynomial:

Of the models available in paramDemo, the “quadratic”, “PeristeraKostaki” (Peristera and Kostaki 2007), and “ColcheroMuller” (Colchero et al. 2021, Muller et al. 2020) fall within the polynomial category. Both, the “PeristeraKostaki” and “ColcheroMuller” are non-symmetric around the age at maximum fertility.

3.b) Distributional:

The distributional models are of the form

g(xβ)=Rf(xβ1),g(x | \bm{\beta}) = R f(x | \bm{\beta}_1),

where f:R0R0f: \mathbb{R}_{\ge 0} \rightarrow \mathbb{R}_{\ge 0} is a probability density function, R>0R > 0 is a parameter for the total fertility rate, and β1β\bm{\beta}_1 \subset \bm{\beta} is a vector of parameters. The “Hadwiger” (Hadwiger 1940), “gamma” (Hoem et al. 1981), “beta” (Hoem et al. 1981), “skewNormal” (Mazzuco and Scarpa 2011, 2015), “gammaMixture” (Hoem et al. 1981), “HadwigerMixture” (Chandola et al. 1991), “skewSymmetric” (Mazzuco and Scarpa 2011, 2015), and “skewLogistic” (Asili et al. 2014) all fall in this category. Notably, the “gammaMixture”, “HadwigerMixture”, “skewSymmetric”, “skewLogistic” are appropriate when fertility might be bimodal (Hoem et al. 1981, Chandola et al. 1999, Mazzuco and Scarpa 2011, 2015, Asili et al. 2014).

4) Specifiying beta parameters:

Argument beta requires a vector of parameters. For instance, for a quadratic model with parameter vector β=[b0,b1,b2]\bm{\beta}^{\top} = [b_0, b_1, b_2] where b0=0.5b_0 = 0.5, b1=0.01b_1 = 0.01 and b2=10b_2 = 10, the argument should be specified as

CalcLifeHist(..., beta = c(b0 = 0.5, b1 = 0.01, b2 = 10), ...)

Note that in this example the parameter names are specified directly, this is required when checkBeta = FALSE. Although assigning the names to each parameter is not necessary when checkBeta = TRUE, it is advisable to ensure that the right values are assigned to the right parameter.

If argument checkBeta is set to TRUE, then the vector of beta parameters is verified for consistency with the requirements of the fertility model selected.

5) Methods to estimate lambda, r, stable age structure and reproductive values:

If argument lambdaMethod is set to “matrix”, the function calculates the assymptotic population growth rate λ\lambda as the dominant eigen-value of the resulting population projection matrix A\bm{A} (Caswell and Wegner 1978, Kroon et al. 1986, Caswell 2001). The intrinsing population growth rate is then r=logλr = \log \lambda, while the stable age-structure, ω=[ω0,ω1,,ωτ]\bm{\omega}^{\top}=[\omega_0, \omega_1, \dots, \omega_\tau], where τ\tau is the maximum age of the population, is given by the corresponding right eigen vector, standardized by its norm. The reproductive value is the corresponding left eigen vector, ν=[ν0,ν1,,ντ]\bm{\nu}^{\top} = [\nu_0, \nu_1, \dots, \nu_\tau], standardized such that ν0=1\nu_0 = 1.

If argument lambdaMethod is set to “Lotka”, the function estimates the intrinsic population growth rate, rr, by finding the real root of Lotka' (1913) equation, given by

0τerxS(x)m(x)dx=1.\int_0^\tau e^{-rx} S(x) m(x) dx = 1.

The stable population structure is then calculated as

ωx=erxS(x)k=0τerkS(k),\omega_x = \frac{e^{-rx} S(x)}{\sum_{k=0}^\tau e^{-rk} S(k)},

while the reproductive value is given by

νx=xτer(kx)S(k)m(k)dkS(x).\nu_x = \frac{\int_x^\tau{e^{-r(k - x)}} S(k) m(k) dk}{S(x)}.

The function then calculates the sensitivities of lambda to age-specific survival as

sp,x=νxωx+1<νω>,for x<τs_{p,x} = \frac{\nu_{x}\omega_{x+1}}{<\bm{\nu}\bm{\omega}>}, \quad \text{for } x<\tau

where the denominator is the inner product, and the sensitivity of lambda to the reproductive value at xx is given by

sm,x=ν1ωx+1<νω>,for x<τs_{m,x} = \frac{\nu_{1}\omega_{x+1}}{<\bm{\nu}\bm{\omega}>}, \quad \text{for } x<\tau

Elasticities are calculated as

ep,x=pxλsp,x and em,x=mxλsm,x.e_{p,x} = \frac{p_x}{\lambda} s_{p,x} \text{ and } e_{m,x} = \frac{m_x}{\lambda} s_{m,x}.

6) Calculation of life history variables

The first life history variables are the intrinsic population growth rate rr and the stable population growth rate λ=er\lambda = e^r, described in the previous section.

The function also provides a number of life history variables described by Tuljapurkar et al. (2009). For instance, it provides the generation time for the stable population as

Ts=0τxerxS(x)m(x)dx,T_s = \int_0^{\tau} x e^{-rx} S(x) m(x) dx,

as well as the cohort generation time, given by

Tc=0τxS(x)m(x)dxR0,T_c = \frac{\int_0^{\tau} x S(x) m(x) dx}{R_0},

where R0R_0 is the net reproductive rate, given by

R0=0τS(x)m(x)dx.R_0 = \int_0^{\tau} S(x) m(x) dx.

It provides the demographic dispersion given by

σd2=0τ(xTc)2S(x)m(x)dxR0\sigma^2_d = \frac{\int_0^\tau (x - T_c)^2 S(x) m(x) dx}{R_0}

which measures the dispersion of reproduction across ages.

Finally, it calculates the population entropy as proposed by Demetrius (1974), given by

H=0τρ(x)logρ(x)dxTsH = - \frac{\int_0^{\tau} \rho(x) \log \rho(x) dx}{T_s}

where ρ(x)=erxS(x)m(x)\rho(x) = e^{-r x} S(x) m(x).

Value

The function produces an object of class “PDlifeHist”, which consists of a list with the following elements:

demoTab

A data frame with the resulting individual ages, the survival S(x)S(x), the age-specific survival probability pxp_x, the age-specific mortality probability qxq_x, the age-specific fertility rate mxm_x, the stable age structure omegaxomega_x, the age specific reproductive value nuxnu_x, and the sensitivities and elasticities.

lifeHist

A data frame with the life history variables described in details, including a description.

settings

A list with the information of the models and parameters as provided by the user.

Author(s)

Fernando Colchero [email protected]

References

Asili S., Rezaei S., Najjar, L. (2014) Using Skew-Logistic Probability Density Function as a Model for Age-Specific Fertility Rate Pattern. BioMed Research International, 2014, 790294.

Azzalini, A. (1985) A Class of Distributions Which Includes the Normal Ones. Scandinavian Journal of Statistics, 2, 171-178.

Caswell, H. & Werner, P. A. (1978) Transient Behavior and Life History Analysis of Teasel (Dipsacus Sylvestris Huds.). Ecology 59, 53-66.

Caswell, H. (2001) Matrix Population Models: Construction, Analysis and Interpretation. (Sinauer Associates).

Chandola, T., Coleman D.A., Hiorns R.W. (1999) Recent European fertility patterns: Fitting curves to ‘distorted’ distributions. Population Studies, 53, 317-329.

Colchero, F. (In prep.) Inference on age-specific fertility in ecology and evolution. Learning from other disciplines and improving the state of the art.

Colchero, F., Eckardt, W., Stoinski, T. (2021) Evidence of demographic buffering in an endangered great ape: Social buffering on immature survival and the role of refined sex-age classes on population growth rate. Journal of Animal Ecology, 90, 1701-1713.

Colchero, F., J.S. Clark (2012) Bayesian inference on age-specific survival from capture-recapture data for censored and truncated data. Journal of Animal Ecology. 81, 139-149.

Colchero, F., O.R. Jones, M. Rebke. (2012) BaSTA: an R package for Bayesian estimation of age-specific survival from incomplete mark-recapture/recovery data with covariates. Method in Ecology and Evolution. 3, 466-470.

Colchero, F., et al. (2021) The long lives of primates and the “invariant rate of aging” hypothesis. Nature Communications 12:3666

Cox, D. R., and Oakes D. (1984) Analysis of Survival Data. Chapman and Hall, London.

Demetrius, L. (1974) Demographic parameters and natural selection. PNAS 71, 4645-4647.

Gompertz, B. (1825) On the nature of the function expressive of the law of human mortality, and on a new mode of determining the value of life contingencies. Philosophical Transactions of the Royal Society of London, 115, 513-583.

Hadwiger, H. (1940) Eine analytische Reproduktionssunktion fur biologische Gesamtheiten. Scandinavian Actuarial Journal, 1940, 101-113.

Hoem, J.M., Madien, D., Nielsen, J.L., Ohlsen, E.M., Hansen, H.O., Rennermalm, B. (1981) Experiments in modelling recent Danish fertility curves. Demography, 18, 231-244.

Keyfitz, N., Caswell, H. (2005) Applied Mathematical Demography. (Springer-Verlag).

Kroon, H. de, Plaisier, A., Groenendael, J. van & Ecology, H. C. (1986) Elasticity: the relative contribution of demographic parameters to population growth rate. Ecology 67, 1427-1431.

Lotka, A. J. (1913) A natural population norm. II. Journal of the Washington Academy of Sciences 3, 289-293.

Makeham, W. M. (1866) On the law of mortality Journal of the Institute of Actuaries 13, 1-34.

Mazzuco, S., Scarpa, B. (2011) Fitting age-specific fertility rates by a skew- symmetric probability density function. (Working paper 10), University of Padua.

Mazzuco, S., Scarpa, B. (2015) Fitting age-specific fertility rates by a flexible generalized skew normal probability density function. Journal of the Royal Statistical Society: Series A, 178, 187-203.

Muller M. N., Blurton Jones N. G, Colchero F., Thompson M. E., Enigk D. K. (2020) Sexual dimorphism in chimpanzee (Pan troglodytes schweinfurthii) and human age-specific fertility. Journal of human evolution, 144, 102795.

Peristera P., Kostaki A. (2007) Modeling fertility in modern populations. Demographic Research, 16, 141-194.

Pinder III, J.E., Wiener, J.G. and Smith, M.H. (1978) The Weibull distribution: a new method of summarizing survivorship data. Ecology, 59, 175-179.

Shkolnikov, V., Andreev, E., Begun, A. Z. (2003) Gini coefficient as a life table function. Demographic Research 8, 305-358.

Siler W. A (1979) competing-risk model for animal mortality. Ecology 60, 750-757.

See Also

CalcDemo to calculate parametric demographic functions.

Examples

# Calculate life histories on the defalult models:
test <- CalcLifeHist(theta = c(b0 = -3, b1 = 0.1), 
                     beta = c(b0 = 1, b1 = 0.01, b2 = 5),
                     ageMatur = 2)
                     
# Print results:
test

# Plot results:
plot(test, type = "all")

Calculating a Life Table from Data.

Description

CalcLifeTable uses non-parametric methods to calculate life tables and confidence intervals.

Usage

CalcLifeTable(ageLast, ageFirst = NULL, departType, dx = 1, 
                          calcCIs = FALSE, nboot = 1000, alpha = 0.05)

Arguments

ageLast

Numerical vector with the ages at last detection (i.e., death and censoring) (see details)

ageFirst

Numerical vector of ages at first detection (i.e., truncation). If NULL then all values are set to 0 (see details).

departType

Character string vector for the type of departure (i.e., last detection), with values “D” for death and “C” for censoring (see details).

dx

Age interval size, default set at 1 (see details)

calcCIs

Logical indicating whether confidence intervals should be calculated

nboot

Number of bootstrap iterations

alpha

Alpha level. Default is 0.05 for 95% CIs

Details

1) Data structure:

CalcLifeTable allows to construct life tables for data that includes the following types of records:

  • Uncensored: individuals with known ages at death;

  • right-censored: individuals last seen alive;

  • left-truncated: individuals born before the start of the study and are truncated at the age of entry.

The data required are the ages at last detection (i.e., uncensored or right-censored) passed through argument “ageLast”, the type of departure via argument “departType”, which takes two values, namely “D” for death, and “C” for censored (i.e., right-censored).

In addition, if there is left-truncation, it takes the ages at entry to the study by means of argument “ageFirst”. If all the individuals were born during the study, the value of “ageFirst” can be left as NULL, which will make them all equal to 0.

2) Computing life tables

To calculate life tables, the function uses conventional formal demgraphic methods as depicted by Preston et al. (2001). Argument “ageLast” provides a vector of ages at last detection, x=[x1,x2,,xn]\bold{x}^{\top} = [x_1, x_2, \dots, x_n], while argument “ageFirst” provides a vector of ages at first detection y=[y1,y2,,yn]\bold{y}^{\top} = [y_1, y_2, \dots, y_n]. From argument “departType” the function produces an indicator vector for censoring v={vi}iNn\bold{v} = \{v_i\}_{i \in \mathbb{N}_n} where vi=1v_i = 1 if individual ii is censored and 0 otherwise.

The function creates a partition of the interval of ages between 0 and max(x)\max(x), for age intervals [x,x+Δx)[x, x + \Delta x) where Δx\Delta x is specified by argument “dx”. As default dx = 1. At each age interval, the function calculates the following variables:

  • Nx: which corresponds to number of individuals that entered the interval, but considering the proportion of time they were present within the interval as a function of left-truncation. It is given by

    Nx=iIxλi,x,N_x = \sum_{i \in I_x} \lambda_{i,x},

    where IxI_x is the subset of individuals recorded within the interval, and λi,x\lambda_{i, x} is the proportion of time during the age interval each individual was present in the study. For individuals that entered the study before xx then λi,x=1\lambda_{i,x} = 1, while for those that were truncated within the interval λi,x=(x+Δxyi)/Δx\lambda_{i,x} = (x + \Delta x - y_i) / \Delta x.

  • Dx: the number of individuals dying in the interval.

  • qx: the age-specific mortality probability, calculated as qx=Dx/Nxq_x = D_x / N_x.

  • px: the age-specific survival probability, given by px=1qxp_x = 1 - q_x.

  • lx: the life table survival calculated as

    lx=j=0x1pjl_x = \prod_{j = 0}^{x-1} p_j

    where l0=1l_0 = 1.

  • ax: Proportion of the interval lived by those that died in the interval, given by

    ax=iJxδi,xDxa_x = \frac{\sum_{i\in J_{x}} \delta_{i,x}}{D_x}

    where JxJ_{x} is the subset of individuals that died within the interval, and δi,x\delta_{i,x} is the proportion lived by those individuals from the start of the interval to their deaths, this is δi,x=(xix)/Δx\delta_{i,x} = (x_i - x) / \Delta x.

  • Lx: The number of individual years lived within the interval, given by

    Lx=lx(1axqx)L_x = l_x (1 - a_x q_x)

  • Tx: The total number of individual years lived after age xx, given by Tx=j=xLjΔxT_x = \sum_{j = x}^{\infty} L_j \Delta x

  • ex: the remaining life expectancy at the beginning of each age interval, calculated as ex=Tx/lxe_x = T_x / l_x.

3) Calculating confidence intervals If argument “calcCIs” is set to TRUE, the function uses a non-parametric bootstrap by sampling with replacement the data. Argument nboot specifies the number of bootstrap steps, with default nboot = 2000. From each re-sampled dataset, it uses function CalcLifeTable to construct the corresponding life table and stores the values of $l_x$, $q_x$, $p_x$, and $e_x$ from each iteration. From these, it calculates quantiles at the given alpha level.

Value

CalcLifeTable returns an object of class “paramDemoLT” with output consisting of a list with the life table and, if indicated by the user, with the confidence interval information. The life table in matrix format includes the following columns:

Ages

Ages with increments given by dx

Nx

Number of individuals entering the interval, does not need to be an integer since it considers truncation

Dx

Number of individuals that died within the age interval

lx

Survival (i.e., cumulative survival)

px

Age-specific survival probability

qx

Age-specific mortality probability

Lx

Number of individual years lived within the interval

Tx

Number of individual years lived after age x

ex

Remaining life expectancy at each age

If argument calcCIs = TRUE, the function also returns a list containing the following components:

lx

Matrix with Ages and mean and upper and lower CIs for the life table survival

qx

Matrix with Ages and mean and upper and lower CIs for the age-specific mortality probability

px

Matrix with Ages and mean and upper and lower CIs for the age-specific survival probability

ex

Matrix with Ages and mean and upper and lower CIs for the remaining life expectancy

Settings

Numerical vector including whether CIs were calculated, the number of bootstrap iterations, “nboot” and the alpha level “alpha

Author(s)

Fernando Colchero [email protected]

References

Preston, S.H., Heuveline, P. and Guillot, M. (2001) Demography: Measuring and Modeling Population Processes. Blackwell, Oxford.

See Also

CalcProductLimitEst to calculate product limit estimators.

Examples

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

# Calculate life table:
lt <- CalcLifeTable(ageLast = ages, departType = rep("D", 100))

# Calculate life table with 95% CIs:
ltCIs <- CalcLifeTable(ageLast = ages, departType = rep("D", 100), 
                       calcCIs = TRUE, nboot = 100)

Calculating Parametric Age-Specific Mortality and survival.

Description

CalcMort and CalcSurv are used to calculate the age-specific mortality and survival functions from different parametric models.

Usage

CalcMort(theta, x, model = "GO", shape = "simple", 
          checkTheta = TRUE)

CalcSurv(theta, x, model = "GO", shape = "simple", 
          checkTheta = TRUE)

Arguments

theta

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

x

Numerical vector of ages at which to calculate mortality.

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

checkTheta

Logical to verify that the beta parameters conform with the model's specification (see details).

Details

1) Age-specific mortality and survival models:

The function CalcMort uses parametric functions to calculate age-specific survival, defined as the probability of surviving to a given age. The function follows the conventions from package BaSTA (Colchero and Clark 2012, Colchero et al. 2012, Colchero et al. 2021). The mortality function or hazard rate describes how the risk of mortality changes with age, and is defined as

μ(xθ)=limΔx0Pr[x<X<x+ΔxX>x]Δx,\mu(x | \theta) = \lim_{\Delta x \rightarrow 0} \frac{\Pr[x < X < x + \Delta x | X > x]}{\Delta x},

where XX is a random variable for ages at death, x0x \geq 0 are ages and θ\theta is the vector of mortality parameters. From the mortality function, the survival function is then given by

S(xθ)=Pr[X>x]=exp[0xμ(tθ)dt],S(x | \bm{\theta}) = \Pr[X > x] = \exp[-\int_0^x \mu(t | \bm{\theta}) dt],

with the cumulative distribution function F(xθ)=1S(xθ)F(x | \bm{\theta}) = 1 - S(x | \bm{\theta}). The probability density function of ages at death is

f(xθ)=μ(xθ)S(xθ),f(x | \bm{\theta}) = \mu(x | \bm{\theta}) S(x | \bm{\theta}),

for x0x \geq 0.

1.1)Argument model:

The model argument allows the user to choose between four basic mortality functions, namely

(a) model = EX”: The exponential model (Cox and Oakes 1974), with constant mortality with age, specified as

μb(xθ)=b,\mu_b(x | \bm{\theta}) = b,

where b>0b > 0, with survival

Sb(xθ)=exp[bx].S_b(x | \bm{\theta}) = \exp[-b x].

(b) model = GO”: The Gompertz mortality model (Gompertz 1925, Pletcher 1999), calculated as

μb(xθ)=exp(b0+b1x),\mu_b(x | \bm{\theta}) = \exp(b_0 + b_1 x),

where <b0,b1<-\infty < b_0, b_1 < \infty, with survival

Sb(xθ)=exp[eb0b1(1eb1x)].S_b(x | \bm{\theta}) = \exp\left[\frac{e^{b_0}}{b_1}\left(1 - e^{b_1 x}\right)\right].

(c) model = WE”: The Weibull mortality model (Pinder III et al. 1978) calculated as

μb(xθ)=b0b1b0xb01,\mu_b(x | \bm{\theta}) = b_0 b_1^{b_0} x^{b_0 -1},

where b0,b1>0b_0, b_1 > 0, with survival

Sb(xθ)=exp[(b1x)b0].S_b(x | \bm{\theta}) = \exp\left[-(b_1 x)^{b_0}\right].

(d) model = LO”: The logistic mortality model (Pletcher 1999), calculated as

μb(xθ)=exp(b0+b1x)1+b2eb0b1(eb1x1),\mu_b(x | \bm{\theta}) = \frac{\exp(b_0 + b_1 x)}{1 + b_2 \frac{e^{b_0}}{b_1} \left(e^{b_1 x}-1\right)},

where b0,b1,b2>0b_0, b_1, b_2 > 0, with survival

Sb(xθ)=[1+b2eb0b1(eb1x1)]1/b2.S_b(x | \bm{\theta}) = \left[1 + b_2 \frac{e^{b_0}}{b_1} \left(e^{b_1 x} - 1\right)\right]^{-1 / b_2}.

1.2)Argument shape:

The shape argument allows the user to extend these models in order to explore more complex mortality shapes.

(a) shape = simple”: (default) Leaves the model as defined above, with mortality given by

μ(xθ)=μb(xθ)\mu(x | \bm{\theta}) = \mu_b(x | \bm{\theta})

and survival

S(xθ)=Sb(xθ.S(x | \bm{\theta}) = S_b(x | \bm{\theta}.

(b) shape = Makeham”: A constant is added to the mortality, such that the mortality is given by

μ(xθ)=c+μb(xθ1),\mu(x | \bm{\theta}) = c + \mu_b(x | \bm{\theta}_1),

where θ=[c,θ1]\bm{\theta} = [c, \bm{\theta}_1], and with survival

S(xθ)=ecxSb(xθ1)S(x | \bm{\theta}) = e^{-cx} S_b(x | \bm{\theta}_1)

The most common models with this shape is the Gompertz-Makeham model (Gompertz 1825, Makeham 1866).

(c) shape = bathtub”: produces a concave shapes in mortality by adding a declining Gompertz term and a constant parameter to the basic mortality model, where the mortality function is

μ(xθ)=exp(a0a1x)+c+μb(xθ1),\mu(x | \bm{\theta}) = \exp(a_0 - a_1 x) + c + \mu_b(x | \bm{\theta}_1),

where a0Ra_0 \in \mathbb{R}, a1,c0a_1, c \geq 0 and θ1θ\bm{\theta}_1 \subset \bm{\theta} are specified based on argument model, and with survival

S(xθ)=exp[ea0a1(ea1x1)cx]Sb(xθ1).S(x | \theta) = \exp\left[\frac{e^{a_0}}{a_1}\left(e^{a_1 x} - 1\right)-cx\right] S_b(x | \theta_1).

The most widely use “bathtub” shaped model is the Siler mortality model (Siler 1979), which provides considerably good fits to mammalian data. The arguments for the Siler model are:

CalcMort(..., model = "GO", shape = "bathtub", ...)

2) Specifying theta parameters:

Argument theta requires a numerical vector of parameters. For instance, for a Gompertz model with simple shape and with parameter vector θ=[b0,b1]\bm{\theta}^{\top} = [b_0, b_1] where b0=5b_0 = -5 and b1=0.1b_1 = 0.1, the argument should be specified as

CalcMort(theta = c(b0 = -5, b1 = 0.1), ...)

Note that in this example the parameter names are specified directly, this is required when checkTheta = FALSE. Although assigning the names to each parameter is not necessary when checkTheta = TRUE, it is advisable to ensure that the right values are assigned to the right parameter.

If argument checkTheta is set to TRUE, then the vector of theta parameters is verified for consistency with the requirements of the model and shape selected.

Value

CalcMort and CalcSur return a vector of class “numeric” with the hazard rate or cumulative survival values at the specified ages, respectively.

Author(s)

Fernando Colchero [email protected]

References

Colchero, F. and J.S. Clark (2012) Bayesian inference on age-specific survival from capture-recapture data for censored and truncated data. Journal of Animal Ecology. 81, 139-149.

Colchero, F., O.R. Jones and M. Rebke. (2012) BaSTA: an R package for Bayesian estimation of age-specific survival from incomplete mark-recapture/recovery data with covariates. Method in Ecology and Evolution. 3, 466-470.

Colchero, F., et al. (2021) The long lives of primates and the "invariant rate of aging" hypothesis. Nature Communications 12:3666

Cox, D. R., and Oakes D. (1984) Analysis of Survival Data. Chapman and Hall, London.

Gompertz, B. (1825) On the nature of the function expressive of the law of human mortality, and on a new mode of determining the value of life contingencies. Philosophical Transactions of the Royal Society of London, 115, 513-583.

Makeham, W. M. On the law of mortality (1866). Journal of the Institute of Actuaries 13, 1-34.

Pinder III, J.E., Wiener, J.G. and Smith, M.H. (1978) The Weibull distribution: a new method of summarizing survivorship data. Ecology, 59, 175-179.

Siler, W. A (1979) competing-risk model for animal mortality. Ecology 60, 750-757.

See Also

CalcSurv to calculate age-specific survival, CalcFert to calculate age-specific fertility.

Examples

# Gompertz age specific mortality (default):
mort <- CalcMort(theta = c(b0 = -5, b1 = 0.1), x = 10)

# Siler age specific mortality:
mort <- CalcMort(theta = c(a0 = -1, a1 = 1, c = 0.0001, 
                          b0 = -6, b1 = 0.15), x = 10,
                  model = "GO", shape = "bathtub")

# Gompertz age specific survival (default):
surv <- CalcSurv(theta = c(b0 = -5, b1 = 0.1), x = 10)

# Siler age specific survival:
surv <- CalcSurv(theta = c(a0 = -1, a1 = 1, c = 0.0001, 
                          b0 = -6, b1 = 0.15), x = 10,
                  model = "GO", shape = "bathtub")

Calculating the product limit estimator from Data.

Description

CalcProductLimitEst uses non-parametric methods to calculate the product limit estimator and confidence intervals.

Usage

CalcProductLimitEst(ageLast, ageFirst = NULL, departType,
                     calcCIs = FALSE, nboot = 1000, alpha = 0.05)

Arguments

ageLast

Numerical vector with the ages at last detection (i.e., death and censoring) (see details)

ageFirst

Numerical vector of ages at first detection (i.e., truncation). If NULL then all values are set to 0 (see details).

departType

Character string vector for the type of departure (i.e., last detection), with values “D” for death and “C” for censoring (see details).

calcCIs

Logical indicating whether confidence intervals should be calculated

nboot

Number of bootstrap iterations

alpha

Alpha level. Default is 0.05 for 95% CIs

Details

1) Data structure:

The function allows to calculate product limit estimator (Wann et al. 1987) for data that includes the following types of records:

  • Uncensored: individuals with known ages at death;

  • right-censored: individuals last seen alive;

  • left-truncated: individuals born before the start of the study and are truncated at the age of entry.

The data required are the ages at last detection (i.e., uncensored or right-censored) passed through argument “ageLast”, the type of departure via argument “departType”, which takes two values, namely “D” for death, and “C” for censored (i.e., right-censored).

In addition, if there is left-truncation, it takes the ages at entry to the study by means of argument “ageFirst”. If all the individuals were born during the study, the value of “ageFirst” can be left as NULL, which will make them all equal to 0.

Value

CalcProductLimitEst returns an object of class “paramDemoPLE” with consists of a data frame and, if indicated by the user, the confidence interval of the PLE. The data frame includes the following numerical columns:

Ages

ages when individuals died

ple

product limit estimator

Lower

If indicated with argument calcCIs, the lower α/2\alpha / 2 confidence bound

Lower

If indicated with argument calcCIs, the upper 1α/21 - \alpha / 2 confidence bound

Author(s)

Fernando Colchero [email protected]

See Also

CalcLifeTable to calculate life tables.

Examples

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

# Calculate life table:
lt <- CalcLifeTable(ageLast = ages, departType = rep("D", 100))

Calculating Remaining Life Expectancy.

Description

CalcRemainingLifeExp calculates remaining life expectancy from parametric models of age-specific mortality.

Usage

CalcRemainLifeExp (theta, x = NULL, dx = NULL, xmax = NULL,
                              atAllAges = FALSE, model = "GO", 
                              shape = "simple", checkTheta = TRUE)

Arguments

theta

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

x

Numerical vector of ages at which to calculate mortality.

dx

Numerical value for the width of age intervals used for integration. If NULL, default is dx = 0.01

xmax

Numerical value for the maximum age. If NULL, the value is obtain as the age when the surviva

atAllAges

Logical to indicate whether ageing rates should be provided between ages 0 and xmax

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

checkTheta

Logical to verify that the beta parameters conform with the model's specification (see details).

Details

The function CalcAgeingRate uses parametric functions to calculate the actuarial (i.e., survival) rate of ageing. The function follows the conventions from package BaSTA (Colchero and Clark 2012, Colchero et al. 2012, Colchero et al. 2021) to select the parametric model of mortality. The mortality function describes how the risk of mortality changes with age, and is defined as

μ(xθ)=limΔx0Pr[x<X<x+ΔxX>x]Δx,\mu(x | \theta) = \lim_{\Delta x \rightarrow 0} \frac{\Pr[x < X < x + \Delta x | X > x]}{\Delta x},

where XX is a random variable for ages at death, x0x \geq 0 are ages and θ\theta is the vector of mortality parameters. From the mortality function, the survival function is then given by

S(xθ)=exp[0xμ(tθ)dt].S(x | \theta) = \exp[-\int_0^x \mu(t | \theta) dt].

(For further details on the mortality and survival models see CalcMort).

Given a vector of ages x1,x2,,xnx_1, x_2, \dots, x_n specified by the user with argument x, the function calculates the remaining life expectancy at age xix_i as

exi=xiS(t)dtS(xi)e_{x_i} = \frac{\int_{x_i}^{\infty} S(t) dt}{S(x_i)}

for i=1,2,,ni = 1, 2, \dots, n.

Value

The function outputs a matrix with the ages from which remaining life expectancies were calculated, and the values for the remaining life expectancy.

Author(s)

Fernando Colchero [email protected]

See Also

CalcSurv to calculate age-specific survival, CalcMort to calculate age-specific mortality, CalcFert to calculate age-specific fertility.

CalcAgeMaxFert to calculate the age at maximum fertility from parametric models of age-specific fertility. CalcAgeingRateMort to calculate ageing rates from parametric models of age-specific mortality.

Examples

# Calculate ageing rate from Gompertz model:
rle <- CalcRemainLifeExp(theta = c(b0 = -5, b1 = 0.1), x = 10)

# Calculate ageing rate from Siler model:
rle <- CalcRemainLifeExp(theta = c(a0 = -1, a1 = 1, c = 0.0001, 
                          b0 = -6, b1 = 0.15), x = 10,
                     model = "GO", shape = "bathtub")

Functions to plot parametric demographic functions

Description

Draw a plot of demographic functions produced with function CalcDemo

Usage

## S3 method for class 'paramDemo'
plot(x, demofun = "all", ...)

Arguments

x

Object of class “paramDemo

demofun

Character string for the demographic function to be ploted

...

Additional arguments passed to function plot

Value

No return value, called for plotting objects of class “paramDemo

Author(s)

Fernando Colchero [email protected]

See Also

CalcDemo to calculate parametric demographic functions.

Examples

# Create paramDemo object from Gompertz mortality and
# quadratic fertility:
dem <- CalcDemo(theta = c(b0 = -5, b1 = 0.1), 
                 beta = c(b0 = 0.5, b1 = 0.01, b2 = 10),
                 summarStats = TRUE, agesAR = c(5, 10))

# Plot demographic object:
plot(dem)

Functions to plot life tables and product limit estimators

Description

Draw a plot of demographic rates from a life table produced with function CalcLifeTable or of product limit estimator produced with function CalcProductLimitEst

Usage

## S3 method for class 'paramDemoLT'
plot(x, demorate = "lx", inclCIs = FALSE, ...)

## S3 method for class 'paramDemoPLE'
plot(x, inclCIs = FALSE, ...)

Arguments

x

Object of class paramDemoLT or paramDemoPLE produced with functions CalcLifeTable or CalcProductLimitEst

demorate

Demographic rate to be plotted, choices are “lx” for the survival, “px” for the age-specific survival probability, “qx” for the age-specific mortality probability, and “ex” for the remaining life expectancy

inclCIs

Logical indicating whether confidence intervals should be ploted in case they were calculated with function CalcLifeTable or CalcProductLimitEst

...

Additional arguments passed to function plot

Value

No return value, called for plotting objects of class “paramDemoLT

Author(s)

Fernando Colchero [email protected]

See Also

CalcLifeTable to calculate life tables. CalcProductLimitEst to calculate product limit estimators.

Examples

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

# Calculate life table:
lt <- CalcLifeTable(ageLast = ages, departType = rep("D", 100))

# Plot life table:
plot(lt)

Summarizing and plotting life history variables from parametric demographic models.

Description

These functions are all generic methods for class PDlifeHist.

Usage

## S3 method for class 'PDlifeHist'
plot(x, type = "rates", ...)

## S3 method for class 'PDlifeHist'
summary(object, ...)

## S3 method for class 'PDlifeHist'
print(x, ...)

Arguments

x

Object of class “PDlifeHist” obtained from function CalcLifeHist

object

Object of class “PDlifeHist” obtained from function CalcLifeHist

type

Character string specifying the type of plot to be drawn, options are “rates”, “sensitivities”, “all

...

Additional arguments passed to functions plot, print, and summary

Details

For objects of class “PDlifeHist”, function print displays on the console the data frame of life history variables produced by function CalcLifeHist.

Function summary prints to the console, first the settings as specified by the user (i.e., theta and beta parameters, and the types of models used), and then, as function print, the table of life history variables.

Function plot with argument type = “rates” produces plots of the age-specific demographic rates (i.e., pxp_x and mxm_x) and the stable age structure and reproductive values (i.e., ωx\omega_x and νx\nu_x). If argument type = “sensitivity”, then it produces plots of the sensitivities and elasticities of λ\lambda to pxp_x and mxm_x.

Value

No return value, called for plotting objects of class “PDlifeHist

Author(s)

Fernando Colchero [email protected]

See Also

CalcLifeHist to calculate life history variables from parametric demographic models.

Examples

# Calculate life histories on the defalult models:
test <- CalcLifeHist(theta = c(b0 = -3, b1 = 0.1), 
                     beta = c(b0 = 1, b1 = 0.01, b2 = 5),
                     ageMatur = 2)
                     
# Print results:
test

# Summary:
summary(test)

# Plot results:
plot(test, type = "all")

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)S(x) for x0x \geq 0, at discrete age intervals [x,x+Δx)[x, x + \Delta x) where Δx\Delta x is specfied with argument “dx”. It then calculates the CDF of ages at death, F(x)F(x), and uses inverse sampling to sample nn ages at death by random sampling from a uniform distribution bound as

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

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

xi=F1(ui).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 [email protected]

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