Visualizing one year of mortality data
Now that you have some feeling with the 1999 life table, you can illustrate the evolution in female mortality rates \(q_x\) as a function of age \(x\). Cynthia's teacher usually plots the log of the mortality rates in his lecture sheets. Can you convince her that this is indeed a good approach?
The object life_table
as well as the vectors age
and qx
defined in the previous exercise have been preloaded.
This exercise is part of the course
Life Insurance Products Valuation in R
Exercise instructions
plot()
(docs) the mortality rates for females in 1999. The first argument has to be theage
and the second has to be the mortality ratesqx
.- Use a second call to
plot()
to display the mortality rates for females in 1999 on the logarithmic scale. Compared to the previous command, you have to transform the second argument by first taking thelog()
(docs).
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Plot the female mortality rates in the year 1999
plot(___, ___,
main = "Mortality rates (Belgium, females, 1999)",
xlab = "Age x",
ylab = expression(paste("Mortality rate ", q[x])),
type = "l")
# Plot the logarithm of the female mortality rates in the year 1999
plot(___, ___,
main = "Log mortality rates (Belgium, females, 1999)",
xlab = "Age x",
ylab = expression(paste("Log mortality rate ", log(q[x]))),
type = "l")