Get startedGet started for free

Calculating life expectancies

1. Calculating life expectancies

The first video of this chapter already introduced life expectancy as the expected value of the future lifetime random variable. This video explains you the essentials of calculating life expectancies.

2. The curtate future lifetime

Let's start from the curtate future lifetime, Kx, that is the number of whole years lived by (x). Kx is the greatest integer that is smaller than or equal to Tx, expressed with the floor() function. The probability that Kx takes value k is the probability that an x-year-old survives k years and then dies within the next year, at age x+k. Hence, a deferred mortality probability. Further manipulation shows that this probability is the difference between the k and the (k+1)-year survival probability of an x-year-old. You verify this equivalence empirically for the example of a 65-year-old in R. What is his 5-year deferred mortality probability? In the first expression you apply the reasoning with the 5-year survival probability and the mortality rate at age 70, while the second expression takes the difference between the 5- and the 6-year survival probability. Both expressions lead to the same result!

3. The curtate life expectancy

Using the probability function of Kx, it is now straightforward to calculate the expected value of this random variable. That is the life expectancy of an x-year-old, expressed in whole years. For each possible outcome k, you multiply k with the probability that Kx realizes this outcome. Taking the sum then results in the curtate life expectancy. Further simplification leads to a simple expression: the sum of the k-year survival probabilities when k runs from 1 to its maximum possible value. Here loosely denoted with +infinity.

4. The life expectancy of a superhero

You already met Mr. Incredible in chapter 1, when working with the loan to finance his new car. Our superhero is 35 years old and lives in Belgium. As an independent superhero he needs to take care of his financial planning. The first question he asks himself is: what is a good estimate of my curtate future lifetime?

5. The life expectancy of a superhero in R

To help Mr. Incredible you calculate the expected value of K35, the random variable that expresses his curtate future lifetime. You need the k-year survival probabilities of a 35-year old where k runs from 1 until its maximal value. The one-year survival probabilities px are obtained as before. The head() function prints the first six entries in this vector, starting from p35. With R's cumprod() function you obtain a vector with the survival probabilities p35, 2p35, 3p35 and so on. Summing these you get the required curtate life expectancy. In this example: Mr. Incredible is expected to live for another 43 and a half years.

6. The expected future lifetime

Finally, you may wonder how to step from the curtate to the complete life expectancy. Recall that the curtate future lifetime Kx is the greatest integer that is smaller than or equal to Tx. Thus, Kx counts in whole years lived and Tx takes - on top of that - also the fraction lived during the year of death into account. Often, the following approximation is used: the complete life expectancy is the curtate life expectancy plus one half.

7. The life expectancy of a superhero in R

Continuing Mr Incredible's example you now compare his curtate life expectancy with his complete life expectancy. You extract the complete life expectancy of a 35-year-old from the life_table object loaded in R. Indeed, the variable ex in this data frame contains the complete life expectancy. As you can see, the difference with the curtate life expectancy is half a year.

8. Let's practice!

Now it's your turn to calculate life expectancies in R.