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
$$
\mu(x | \theta) = \lim_{\Delta x \rightarrow 0} \frac{\Pr[x < X < x + \Delta x | X > x]}{\Delta x},
$$
where \(X\) is a random variable for ages at death, \(x \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 | \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 \(x_1, x_2, \dots, x_n\) specified by the user with argument x, the function calculates the remaining life expectancy at age \(x_i\) as
$$
e_{x_i} = \frac{\int_{x_i}^{\infty} S(t) dt}{S(x_i)}
$$
for \(i = 1, 2, \dots, n\).