Deferred life insurance
Cynthia now challenges Ethan to change the code himself to calculate the EPV of a deferred life insurance on \((x)\) for a given constant interest rate \(i\). The following figure shows the corresponding timeline for a deferral period of \(u\) years.
There is no death benefit if the policyholder dies during the first \(u\) years. From time \(u\) on, a death benefit of 1 EUR is payable at the end of the year of death of the policyholder.
The function whole_life_insurance()
and the EPV of a whole life insurance for a 20-year-old at interest rate \(i = 2\%\) and using the 1999 female life_table
are given as a starting point.
This exercise is part of the course
Life Insurance Products Valuation in R
Exercise instructions
- Specify the
deferred_life_insurance()
function which computes the EPV of a deferred life insurance for a givenage
, deferral periodu
, interest ratei
andlife table
. - Apply the
deferred_life_insurance()
function to compute the EPV of a life insurance with a deferral period of 45 years. Use age 20, interest rate 2% and the preloaded 1999 femalelife_table
.
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 deferred whole life insurance
deferred_life_insurance <- function(age, u, i, life_table) {
qx <- life_table$qx; px <- 1 - qx
kpx <- c(1, cumprod(px[(age + 1):(length(px) - 1)]))
kqx <- kpx * qx[(age + 1):length(qx)]
discount_factors <- (1 + i) ^ - (1:length(kqx))
benefits <- c(rep(___, ___), rep(___, length(kpx) - u))
sum(___ * discount_factors * kqx)
}
# EPV of a deferred life insurance for (20) deferred over 45 years at interest rate 2% using life_table
deferred_life_insurance(___, ___, ___, ___)