Get Started

Deferred mortality probabilities

In this exercise, you will help Cynthia to better understand the concept of a \(k\)-year deferred mortality probability for an 18-year-old. This is the probability that one first survives \(k\) years, reaches age \(18+k\) and then dies in the next year:

$$ \begin{aligned} {}_{k|}q_{18} &= {}_kp_{18} \cdot q_{18+k}. \end{aligned} $$ These probabilities with \(k = 0, 1, 2, \ldots\) determine a discrete probability distribution. They run over all possible ages at death for the 18-year-old and express the corresponding probability to die at each of these ages.

The mortality rates \(q_x\) and the one-year survival probabilities \(p_x\) have been preloaded as qx and px.

This is a part of the course

“Life Insurance Products Valuation in R”

View Course

Exercise instructions

  • Define kpx as the survival probabilities \({}_kp_{18}\) of an 18-year-old for \(k = 0, 1, 2, \ldots\)
  • Assign the deferred mortality probabilities \({}_{k|}q_{18}\) to the variable kqx by multiplying kpx with the mortality rates qx from 18 + 1 until length(px).
  • Compute the sum() of kqx to verify that it equals one.
  • Visualize the kqx against 0:(length(kqx) - 1).

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Compute the survival probabilities of (18)
kpx <- c(___, ___(px[(___):(length(px) - 1)]))

# Compute the deferred mortality probabilities of (18)
kqx <- ___ * qx[(___):___]

# Print the sum of kqx
___

# Plot the deferred mortality probabilities of (18)
plot(___, ___, 
    pch = 20, 
    xlab = "k", 
    ylab = expression(paste(""['k|'], "q"[18])),
    main = "Deferred mortality probabilities of (18)")

This exercise is part of the course

Life Insurance Products Valuation in R

IntermediateSkill Level
5.0+
2 reviews

Learn the basics of cash flow valuation, work with human mortality data and build life insurance products in R.

Life tables play a vital role in life insurance products. In this chapter you will work with data sets from the Human Mortality Database by building meaningful visualizations to study the evolution of mortality data over age and time. You will also use survival and death probabilities.

Exercise 1: Random future lifetimeExercise 2: Like it's 1999!Exercise 3: Visualizing one year of mortality dataExercise 4: Men versus womenExercise 5: Binomial experimentsExercise 6: How likely is Cynthia to live to 100?Exercise 7: The number of deathsExercise 8: Calculating probabilitiesExercise 9: Multiplication rules!Exercise 10: Deferred mortality probabilities
Exercise 11: Calculating life expectanciesExercise 12: Curtate vs complete life expectancyExercise 13: Plotting life expectancies by ageExercise 14: DynamicsExercise 15: Mortality rates over timeExercise 16: Cohort survival probabilities

What is DataCamp?

Learn the data skills you need online at your own pace—from non-coding essentials to data science and machine learning.

Start Learning for Free