目录

R语言寿险精算(一):年金保险

教材: Actuarial Mathematics for Life Contingent Risks

参数列表

life_table: A life table with mortality rates $q_x$ from age 0.

age: The individual’s age at this moment.

i: A given constant interest rate.

n: A given period of temporary products.

终身生存年金

Whole Life Immediate Annuity: $a_x$

生存期间定期给付。

期望现值 $=$ $\sum_{0 or 1}^{最大存活年限}$ 现金流 $\times$ 折现系数 $\times$ 存活概率

1life_immediate_annuity <- function(age, i, life_table) {
2  px <- 1-life_table$qx
3  kpx <- cumprod(px[(age+1):length(px)])
4  discount_factors <- (1+i) ^ - (1:(length(kpx)))
5  sum(discount_factors * kpx)
6}

定期生存年金

Temporary Life Annuity: $a_{x:\overline n|}$

n年期间存活时定期给付。

期望现值 $=$ $\sum_{0 or 1}^{n}$ 现金流 $\times$ 折现系数 $\times$ 存活概率

1temporary_life_annuity <- function(age,n, i, life_table) {
2  px <- 1-life_table$qx
3  kpx <- cumprod(px[(age+1):(age+n-1)])
4  discount_factors <- (1+i) ^ - (1:(length(kpx)))
5  sum(discount_factors * kpx)
6}

养老金 / 延期年金

Pension / Deferred Whole Life Annuity: $_{u|}a_x$
假设养老金为到达退休年龄期初给付,从投保到退休期间的u年不给付,退休时每期的金额为定值benf
1pension_due <- function(age, u, i, benf, life_table){
2  px <- 1-life_table$qx
3  kpx <- c(1, cumprod(px[(age+1):(length(px))]))
4  discount_factors <- (1+i) ^ -(0:(length(kpx)-1))
5  benefits <- c(rep(0,u),rep(benf,(length(kpx)-u)))
6  sum(benefits*discount_factors*kpx)
7}

增额年金

Increasing Whole Life Annuity: $(Ia)_x$

每年的现金流金额不固定,单独拟合现金流数组。

此处假设增额年金的第1期支付金额为1,之后每期按1增长。即第2期为3,第3期为4……

1increasing_life_annuity_due <- function(age, i, life_table) {
2  px <- 1-life_table$qx
3  kpx <- c(1, cumprod(px[(age+1):length(px)]))
4  discount_factors <- (1+i) ^ - (0:(length(kpx)-1))
5  benefits <- c(1:length(kpx))
6  sum(benefits * discount_factors * kpx)
7}