Get startedGet started for free

Like it's 1999!

Cynthia is now 18 and registered in the actuarial program at KU Leuven in Belgium. This term she takes a course on life insurance mathematics. Using R she is asked to build meaningful visualizations of lifetime data statistics. You will assist her by inspecting the Belgian mortality data for females as registered in the year 1999. This is not just Cynthia's year of birth; '1999' is also her favorite Prince song! The mortality rates have been obtained from the Human Mortality Database and are stored in the data set life_table.

In this exercise, you will work with a data frame object in R by exploring what is contained in life_table.

This exercise is part of the course

Life Insurance Products Valuation in R

View Course

Exercise instructions

  • Verify the structure of life_table using the function str() and the first and last entries of life_table using head() and tail().
  • Extract the variables age, qx and ex from life_table using the $ notation.
  • Print the probability \(q_{18}\) that an 18-year-old in 1999 would die before turning 19.
  • Print the expected future lifetime \(e_{18}\) of an 18-year-old in 1999?

Hands-on interactive exercise

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

# Inspect life_table using str(), head() and tail()
___
___
___

# Define age, qx and ex
age <- ___
qx <- ___
ex <- ___

# The probability that (18) dies before turning 19
___

# The expected future lifetime of (18)
___
Edit and Run Code