R for Life Annuities
Contents
ref: Actuarial Mathematics for Life Contingent Risks
EPVs of Life Annuities
-
Whole Life Annuity Due: $\ddot a_x$
-
Whole Life Immediate Annuity: $a_x$
-
Temporary Life Annuity Due: $\ddot a_{x:\overline n|}$
-
Temporary Life Annuity: $a_{x:\overline n|}$
-
Pension / Deferred Whole Life Annuity: $_{u|}a_x$
-
Increasing Whole Life Annuity Due: $(I\ddot a)_x$
Argument List
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 Annuity Due
1# Function to compute the EPV of a whole life annuity due for a given age, interest rate i and life table
2life_annuity_due <- function(age, i, life_table) {
3 px <- 1-life_table$qx
4 kpx <- c(1, cumprod(px[(age+1):length(px)]))
5 discount_factors <- (1+i) ^ - (0:(length(kpx)-1))
6 sum(discount_factors * kpx)
7}
Whole Life Annuity
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 Due
1temporary_life_annuity_due <- function(age,n, i, life_table) {
2 px <- 1-life_table$qx
3 kpx <- c(1,cumprod(px[(age+1):(age+n-1)]))
4 if ((age+1)>(age+n-1)) {kpx <- c(1)} # fix 1
5 discount_factors <- (1+i) ^ - (0:(length(kpx)-1))
6 sum(discount_factors * kpx)
7}
Temporary Life Annuity
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
Assumption
Pension payment at the beginning of retirement age. The benefits are 0 for the first
u years and a fixed annual payment of benf thereafter.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 Due
Note
An whole life annuity-due commencing at 1 and increasing 1 per annum.
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}