定期寿险
Ethan 想了解当保险保障期限受到限制时,寿险的 EPV 会如何变化,如下图所示。
他先计算了一份针对 20 岁个体的终身寿险 EPV,利率为 $i = 2\%$,并使用已预加载的 1999 年比利时女性 life_table。
以上一练习中创建的 whole_life_insurance() 为起点,您能协助 Cynthia 编写一个用于定期寿险的函数吗?
本练习是课程的一部分
用 R 评估人寿保险产品
练习说明
- 定义函数
temporary_life_insurance(),用于计算定期寿险的 EPV。除常用参数age、i和life_table外,函数还需新增参数n,表示寿险保障的年限。 - 使用您新定义的
temporary_life_insurance()函数,计算当保障期限限制为 45 年时,(20) 在 2% 利率下的寿险 EPV 会发生怎样的变化。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# 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(___, ___, ___, ___)