Temporary life insurance
Ethan wonders how the EPV of a life insurance changes in case the coverage is restricted in time, as shown in the figure below.
He first calculates the EPV of a whole life insurance for a 20-year-old at an interest rate \(i = 2\%\) and using the preloaded life_table
for females in Belgium in 1999.
Starting from the function whole_life_insurance()
created in the previous exercise, can you assist Cynthia in writing a function for a temporary life insurance?
This exercise is part of the course
Life Insurance Products Valuation in R
Exercise instructions
- Define the function
temporary_life_insurance()
which computes the EPV for a temporary life insurance. Besides the recurring argumentsage
,i
andlife_table
, the function now takes an additional argumentn
indicating the number of years the life insurance coverage holds. - Use your newly defined
temporary_life_insurance()
function to calculate how the EPV of the life insurance of (20) at rate 2% changes when the coverage is restricted to a period of 45 years.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# EPV of a whole life insurance for (20) at interest rate 2% using life_table
whole_life_insurance(20, 0.02, life_table)
# Function to compute the EPV of a temporary life insurance
temporary_life_insurance <- function(age, n, i, life_table) {
qx <- life_table$qx
px <- 1 - qx
kpx <- c(1, cumprod(px[(___):(___)]))
kqx <- kpx * qx[(___):(___)]
discount_factors <- (1 + i) ^ - (1:length(kqx))
___(___ * ___)
}
# EPV of a temporary life insurance for (20) over a period of 45 years at interest rate 2% using life_table
temporary_life_insurance(___, ___, ___, ___)