開始使用免費開始

延遲給付終身壽險

Cynthia 現在要 Ethan 親自修改程式碼,計算在固定利率 \(i\) 下,\((x)\) 的延遲給付終身壽險的 EPV。下圖顯示延遲期為 \(u\) 年時的時間軸。

若被保險人在前 \(u\) 年內死亡,不給付身故保險金。自時間點 \(u\) 起,於被保險人死亡年度的期末給付 1 EUR 的身故保險金。

作為起點,已提供 whole_life_insurance() 函式,以及對 20 歲、利率 $i = 2\%$、並使用 1999 年女性 life_table 的終身壽險 EPV。

本練習屬於課程

以 R 估值人壽保險商品

檢視課程

練習說明

  • 定義 deferred_life_insurance() 函式,用於計算給定 age、延遲期 u、利率 ilife table 的延遲給付終身壽險 EPV。
  • 套用 deferred_life_insurance(),計算延遲期為 45 年的壽險 EPV。使用年齡 20、利率 2% 與預先載入的 1999 年女性 life_table

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# 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(___, ___, ___, ___)
編輯並執行程式碼