1. Binomial experiments
Mortality rates are one-year probabilities of dying. You will now set up binomial experiments with such rates.
2. The life table in R
Here's the life table again: Belgian males, observed in 2013. In this video you'll work with qx, its complement px, and you'll find out what lx and dx represent.
3. A binomial experiment: surviving one year
The lx variable in life_table starts with 100,000 newborns, alive at age 0.
Out of this group, lx individuals survive up to age x.
Picture this as follows: you flip a coin for each individual, with probability px he will survive and reach age x+1, with probability qx he will die at age x.
4. A binomial experiment: surviving one year
The number of survivors is therefore binomially distributed: lx individuals or experiments at age x, with probability of success px applicable to each of them.
Let's set up such an experiment for the Eddy Merckx group, the 72-year-olds. You first extract the number of people alive at age 72 and their applicable probability of success. Then, you draw one simulation for the number of people who will survive up to age 73, using the rbinom() function. This draw gives 72,022 in this experiment. Of course, you can repeat this binomial experiment multiple times by changing the argument n.
5. A binomial experiment: surviving one year
Now let's sample the number of survivors for every age x in life_table simultaneously. You do this by using rbinom() in a vectorized way with the vectors lx and px. This single command generates n draws where n is the number of rows in life_table. Each of these is a draw for the number of survivors at age x, where x now runs from 0 to the maximal age in the table.
6. A binomial experiment: surviving $k$ years
You may recall that the expected value of a binomial distribution is the number of experiments multiplied with the probability of success. In this setting, that is lx multiplied with px. The result is the expected number of people alive at age x+1. That's lx+1.
With a similar reasoning you consider the number of people who will survive up to age x+k. The probability kpx denotes the k-year survival probability of an x-year-old. It expresses the probability that an x-year-old will survive up to age x+k. The number of k-year survivors again follows a binomial distribution, with expected value lx times kpx. And that is lx+k. Thus, kpx can be extracted from the life table as the ratio of lx+k and lx!
7. A binomial experiment: the number of deaths
Now you'll focus on the expected number of deaths at age x. Each of the lx individuals alive at age x will die with probability qx. Hence, the expected number of deaths follows a binomial distribution with parameters lx and qx. Its expected value is lx times qx and actuaries use the notation dx for the expected number of deaths at age x. dx is the difference of lx and lx+1. You see the connection between dx and lx illustrated in the R code, where on average 1946 out of the initial group of 100,000 individuals die at age 72.
8. Survival probabilities in R
Let's calculate the 5-year survival probability of a 65-year-old from the given life table. That's the ratio of l70 over l65, which you can again extract either by using the vector age or by index.
9. Picturing survival probabilities in R
You can repeat this calculation to express the k-year survival probability for a 65-year-old, when k runs from 0 to 45. You vectorize the code by defining a vector k. R will then calculate the 0- up to 45-year survival probability of a 65-year-old in a vectorized way. Plotting shows the survival curve of a 65-year-old which starts at 1 and declines to 0.
10. Let's practice!
Now it's your turn.