開始使用免費開始

定期壽險

Ethan 想知道,當保險的保障期間受到時間限制時,壽險的 EPV(期望現值)會如何改變,如下圖所示。

他先以利率 $i = 2\%$,並使用已載入的 1999 年比利時女性 life_table,計算 20 歲投保者的終身壽險 EPV。

延續前一題建立的 whole_life_insurance() 函式,現在你能協助 Cynthia 撰寫用於定期壽險的函式嗎?

本練習屬於課程

以 R 估值人壽保險商品

檢視課程

練習說明

  • 定義函式 temporary_life_insurance(),用來計算定期壽險的 EPV。除了常見的引數 ageilife_table 之外,函式還需多一個引數 n,表示壽險保障有效的年數。
  • 使用你新定義的 temporary_life_insurance() 函式,計算當將 20 歲、利率 2% 的壽險保障限制為 45 年期間時,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(___, ___, ___, ___)
編輯並執行程式碼