Life Contingent Risks#
Life contingencies use probability models as well as interest rate functions. By modeling future lifetimes as random variables, probabilities of survival or death can be calculated. This section reviews essential probability relationships and the moments of common distributions.
Probability#
The cumulative distribution function of a r.v. X is the probability \(F(x) = Pr(X \le x)\). For a continuous r.v., \(f(x) = \frac{d}{dx} F(x)\) is the probability density function. For a discrete r.v. \(p(x) = Pr(X=x)\) is the probability mass function.
\(E(x) = \int_{-\infty}^{\infty} xf(x) dx\) when continuous, or \(\sum_x x f(x)\) when discrete
is the mean, or first moment of \(X\).
\(Var(x) = E[(X - E[x])^2]\)
is the variance, or second central moment of \(X\), often denoted \(\sigma^2\)
Linearity of expectations
\(E(a + bX + cY) = a + bE(X) + cE(Y)\)
the mean of the sum of random variables is the sum of the means
Variances
\(Var(aX + bY) = a^2~Var(X) + b^2~Var(Y) + 2~a~b~Cov(X,Y)\)
is the formula to compute the variance of the weighted sum of two random variables
\(Cov(X, Y) = E[XY] - E[X] \cdot E[Y]\)
is the formula to compute the covariance between two random variables
Bernoulli:
The Bernoulli is a discrete distribution that takes one of two values \(Y \in \{a,~b\}\) with probabilities \((p, ~1-p)\)
\(E[Y] = a~p + b~(1-p)\)
mean of Bernoulli distribution
\(Var[Y] = (a-b)^2~p~(1-p)\)
Bernoulli shortcut formula for the variance
Binomial:
A binomial r.v. measures the total number of successes from \(N\) independent 0-1 Bernoulli r.v., where each has a probability of success \(p\).
\(E[Y] = N~p\)
mean of Binomial distribution
\(Var[Y] = N~p~(1-p)\)
variance of Binomial distribution
Mixture
A mixture distribution is a random variable \(Y\) whose distribution function can be expressed as a weighted average of the distribution functions of \(n\) random variables \(Y_1, \cdots, Y_n\). A common case is when Y is a mixture of two Binomial distributions \((p',~N)\), where \(p' \in (p_1,~p_2)\) with respective probabilities \((p,~1-p)\): a value is first drawn from a Bernoulli random variable w.p. \(p\), then depending on its value, a final value is then drawn from the selected one of the two component Binomial distributions.
\(E[Y] = p~N~p_1 + (1-p)~N~p_2\)
mean of mixture of two Binomial distributions
\(Var[Y] = E[Y^2] - E[Y]^2 = E[Var(Y~|~p') + E(Y~|~p')^2] - E[Y]^2\)
variance of mixture of two Binomial distributions
Conditional Variance
\(Var[Y] = Var(E[Y~|~p']) + E[Var (Y~|~p')]\)
alternative calculation of the variance of a mixture by using conditional variance formula, where the first term can be easily calculated using the Bernoulli shortcut, since \(E[Y~|~p']\) is a Bernoulli random variable that takes a value of either \(E[Y~|~p_1]\) or \(E[Y~|~p_2]\) with respective probabilities \((p, 1-p)\)
Portfolio Percentile#
Normal Approximation
A portfolio, \(Y\), which is the sum of \(N\) iid random variables each with mean \(\mu\) and variance \(\sigma^2\), has a normal distribution with
mean \(E[Y] = N~\mu\) and
variance \(Var[Y] = N~\sigma^2\)
Percentiles
Percentiles are essentially an inverse function of the cumulative probability distribution. If \(F(y)\) is the cdf for \(Y\), then the p’th quantile (or \(100p\)’th percentile) is a number \(y_p\) such that \(F(y_p) = Pr(Y \le y_p)= p\).
\(Y_p = E[Y] + z_p~\sqrt{Var[Y]}\)
value of \(Y\) at percentile \(p\) when Y is normally distributed, where \(z_p\) is the inverse standard normal function \(z_p = \Phi^{-1}(p)\)
Methods#
The Life class implements methods for computing moments and probability distributions of random variables.
import math
from actuarialmath import Life
import describe
describe.methods(Life)
class Life - Compute moments and probabilities
Methods:
--------
variance(a, b, var_a, var_b, cov_ab):
Variance of weighted sum of two r.v.
covariance(a, b, ab):
Covariance of two r.v.
bernoulli(p, a, b, variance):
Mean or variance of bernoulli r.v. with values {a, b}
binomial(p, N, variance):
Mean or variance of binomial r.v.
mixture(p, p1, p2, N, variance):
Mean or variance of binomial mixture
conditional_variance(p, p1, p2, N):
Conditional variance formula
portfolio_percentile(mean, variance, prob, N):
Probability percentile of the sum of N iid r.v.'s
set_interest(interest):
Set interest rate, which can be given in any form
quantiles_frame(quantiles):
Display selected quantile values from Normal distribution table
Examples#
The variance method computes the variance of \(aX + bY\) by plugging in the required inputs into the formula \(a^2~Var(X) + b^2~Var(Y) + 2~a~b~Cov(X,Y)\). Similarly, the covariance method computes the covariance of \(X\) and \(Y\) by pluggin the required inputs into the formula \(E[XY] - E[X] \cdot E[Y]\)
Life.variance(a=2, b=3, var_a=4, var_b=5, cov_ab=6)
133
Life.covariance(a=2, b=3, ab=8)
2
The bernoulli and binomial methods compute the mean or variance (by setting the argument variance=True) of the respective probability distributions
print(Life.bernoulli(p=0.5, a=0, b=1), Life.bernoulli(p=0.5, a=0, b=1, variance=True))
0.5 0.25
print(Life.binomial(p=0.5, N=100), Life.binomial(p=0.5, N=100, variance=True))
50.0 25.0
For a mixture of two binomial distribution, the mixture method computes the mean or variance, while the conditional_variance method computes the variance using the conditional variance formula.
print(Life.mixture(p=0.5, p1=0.3, p2=0.4, N=100),
Life.mixture(p=0.5, p1=0.3, p2=0.4, N=100, variance=True))
35.0 47.5
The sum of \(N\) iid r.v. with identical mean and variance can be approximated by a normal distribution that is computed by the portfolio_cdf method, or whose \(100p\)’th percentile is computed by the portfolio_percentile method.
Life.portfolio_cdf(mean=0, variance=1, N=50, value=5)
0.7602499389065233
Life.portfolio_percentile(mean=0, variance=1, N=50, prob=0.76)
4.994313317536634
The set_interest method is called to initialize and store an Interest object with the assumed interest rate, expressed in any annual or \(m\)-thly form, which is used in all subsequent life contingency computations.
life = Life().set_interest(i=0.05)
life.interest.delta
0.04879016416943205
SOA Question 2.2:
Scientists are searching for a vaccine for a disease. You are given:
100,000 lives age x are exposed to the disease
Future lifetimes are independent, except that the vaccine, if available, will be given to all at the end of year 1
The probability that the vaccine will be available is 0.2
For each life during year 1, \(q_x\) = 0.02
For each life during year 2, \(q_{x+1}\) = 0.01 if the vaccine has been given and \(q_{x+1}\) = 0.02 if it has not been given
Calculate the standard deviation of the number of survivors at the end of year 2.
print("SOA Question 2.2: (D) 400")
p1 = (1. - 0.02) * (1. - 0.01) # 2_p_x if vaccine given
p2 = (1. - 0.02) * (1. - 0.02) # 2_p_x if vaccine not given
print(math.sqrt(Life.conditional_variance(p=.2, p1=p1, p2=p2, N=100000)))
print(math.sqrt(Life.mixture(p=.2, p1=p1, p2=p2, N=100000, variance=True)))
SOA Question 2.2: (D) 400
396.5914603215815
396.5914603237804
Normal distribution table:
The quantiles_frame method displays an extract of normal distribution table for common quantile values, that is made available during SOA FAM-L exam.
print("Values of z for selected values of Pr(Z<=z)")
print("-------------------------------------------")
print(Life.quantiles_frame().to_string(float_format=lambda x: f"{x:.3f}"))
Values of z for selected values of Pr(Z<=z)
-------------------------------------------
z 0.842 1.036 1.282 1.645 1.960 2.326 2.576
Pr(Z<=z) 0.800 0.850 0.900 0.950 0.975 0.990 0.995