0% found this document useful (0 votes)
274 views27 pages

Life Contingencies Vignettes

The lifecontingencies package in R provides functions for performing actuarial present value calculations related to life insurance. It contains classes for handling life tables and actuarial tables. Functions are grouped into demographic calculations, financial mathematics, and life contingencies analysis. Key functions allow calculating values for various life insurance contracts such as term life, annuities, and endowments. The package aims to provide computational support for concepts in classical life contingencies theory.

Uploaded by

gaby-01
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
274 views27 pages

Life Contingencies Vignettes

The lifecontingencies package in R provides functions for performing actuarial present value calculations related to life insurance. It contains classes for handling life tables and actuarial tables. Functions are grouped into demographic calculations, financial mathematics, and life contingencies analysis. Key functions allow calculating values for various life insurance contracts such as term life, annuities, and endowments. The package aims to provide computational support for concepts in classical life contingencies theory.

Uploaded by

gaby-01
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Introduction to lifecontingencies Package

Giorgio Alfredo Spedicato


Universit a Cattolica del Sacro Cuore

Abstract lifecontingencies performs actuarial present value calculation for life insurances. This paper briey recapitulate the theory regarding life contingencies (life tables, nancial mathematics and related probabilities) on life contingencies. Then it shows how lifecontingencies functions represent a perfect cookbook to perform life insurance actuarial analysis and related stochastic simulations.

Keywords : life tables, nancial mathematics, actuarial mathematics, life insurance, R.

Dr

As of December 2011, lifecontingencies seems the rst R package that deals with life insurance evaluation. R has provided many package that actuaries can use within their professional activity. However most packages are of mainly interest of non-life actuaries, due to the wider importante of regression modelling and distribution tting in non - life than in life insurance. The package actuar, Dutang, Goulet, and Pigeon (2008), provides functions to t loss distributions and to perform credibility analysis. Package actuar represents the computational side of the classical book Klugman, Panjer, Willmot, and Venter (2009). The package ChainLadder, Gesmann and Zhang (2011), provides functions to estimate non-life loss reserve. GLM analysis widely used in predictive modelling can be performed by the base package bundled within R. Specic models can be using the gamlss package, Rigby and Stasinopoulos (2005), or the cplm package, Zhang (2011). Life actuaries conversely work more with demographic and nancial data. R has a dedicated view to packages dedicated to nancial analysis. However few packages exist to perform demographic analysis (as demography, Rob J Hyndman, Heather Booth, Leonie Tickle, and John Maindonald (2011), and LifeTables, Rie (2011)). Finally no package exists that performs life contingencies calculations, as of December 2011. Numerous commercial software specically tailored to actuarial analysis are available in commerce. Moses and Prophet are currently the leading actuarial software in life insurance. This package aims to represent the R computational support of the concepts developed in the classical life contingencies book Bowers, Gerber, Hickman, Jones, and Nesbitt (1997). Since life contingencies theory grounds on demography and classical nancial mathematics, I have made use of the Ruckman and Francis Ruckman and Francis and Broverman Broverman (2008) as references. The structure of the vignette document is:

af t
1. Introduction

A package to evaluate actuarial present values 1. Section 2 describes the underlying statistical and nancial concepts regarding life contingencies theory. 2. Section 3 overviews the general structure of the package. 3. Section 4 gives a wide choice of lifecontingencies packages example. 4. Finally section 5 will provide a discussion of results and further potential developments.

2. Life contingencies statistical and nancial foundations


Life insurance analysis involves the calculation of expected values of future cash ows, whose probabilities depend by events related to insured life contingencies and time value of money. Therefore life insurance actuarial mathematics grounds itself on concepts derived from demography and theory of interest (like present value). A life table (also called a mortality table or actuarial table) is a table that shows, for each age x, the number of subjects lx that are expected to be in life (at risk) at the beginning of age x. It represents a sequence of l0 , l1 , . . . , l being the farthest age that a person can obtain for the life table cohort. A life table is referred to a cohort of subjects, typically varying by sex, year of birth and country. Many statistics can be derived from the lx sequence. A non exhaustive list follows:
t px =
lx+t lx ,

the probability that someone living at age x will reach age x + t.

Dr
t Lx =
n

t qx , the complementary probability of t px .

t dx , the number of deaths between age x and x + t.

lx+t , the expected number of years lived by the cohort between ages x and

x + t.

t=0

t mx =

t dx t Lx

, the central mortality rate between ages x and x + t.

ex , the expected remaining lifetime for someone living at age x.

An exhaustive coverage of life table demographics can be found in Keytz and Caswell (2005). Life table are usually produced by institutions that have access to large amount of reliable historical data, like ocial statistics or social security bureaus. Actuaries often start from those table and modify underlying survival probabilities to make the table better t to the insured pool experience. Life table analysis provides the empirical data to assess the time until - death random variables for any individual aged x, being Tx and Kx the continuous and curtate form respectively. Classical nancial mathematics deals with monetary amount that could be available in different times. The most important concept in classical nancial mathematics is the present

af t

Giorgio Alfredo Spedicato

value (see formula 2). Present value represents the current value of a series of monetary cash ows, CFt , that will be available in dierent periods of time. The interest rates, it , represents the measure of price of money per unit of time. Formula 1 shows the relationship between the accumulation function, A (t) and interest and discount rates, both eective and nominal.

A (t) = (1 + i)t = (1 d)t =

1+

im m

tm

dm m

tm

(1)

All nancial mathematics functions (as annuities, a n , or accumulated values, sn ) can be written as a particular case of formula 2.

Actuaries uses the probabilities inherent the life table to evaluate life contingencies insurances. Life contingencies are themselves stochastic variables, in fact. They consist in present values whose amounts are not certain, but the time and the nal values depend by events regarding the life of the insured head. Their expected value is named actuarial present value (APV). While APV is certainly the most important statistic used by actuaries, as long as it represents the average cost of the coverage the insurer provides, lifecontingencies provides functions to assess the distribution of life contingencies quantities as random value generation. Some examples of life contingencies follow. The term life insurances represent a contract where a sum bt is payable whether the insured head dies within n years. A at n - term life 1 . insurance is expressed in formula 3 and its APV symbol is Ax :n Zn =
T bT v T n >n 0T

Dr
k=0 k

af t
tT

PV =

CFt (1 + it )t

(2)

(3)

Another example is the annuity due, a x , that consists in a series of cash ows of equal amounts payable at the beginning of each period until death. Formula 4 expresses its APV. a k+1| px qx+k (4)

The pure endowment is a stochastic variable dened in formula 5. Its APV symbol is n Ex . Under a pure endowment contract a sum is paid after n year if the insured aged x still lives at age x + n. >n vT , T 0, T n (5)

The lifecontingencies package provides functions that allows the user to evaluate standard life insurance contract APV. Function for Ax (life insurance), n Ex (the pure endowment), a x 1 (the annuity due), (DA)x (the decreasing term life insurance) and ( IA ) (increasing term x :n

A package to evaluate actuarial present values

life insurance) are available as long as variants. Most important variants consist in allowing fractional terms and temporary duration. . In general present values can be expressed as the scalar product of full value cash ows c and their corresponding discount rate v . APV formula taxes into account the present value. While most nancial mathematics and lifecontingencies formulas can be expressed in symbolic form, lifecontingencies will evaluate present values and APVs using vector calculus. Therefore lifecontingencies builds the vectors of payments, c , discounts, v and probabilities, p and it evaluates their scalar product as shown by equation 6.

c v p

(6)

Dr

af t

Giorgio Alfredo Spedicato

3. The structure of the package


Package lifecontingencies contains classes and methods to handle lifetables and actuarial tables conveniently. The package is loaded within the R command line as follows: R> library(lifecontingencies) Two main S4 classes Chambers (2008) have been dened within the lifecontingencies package: the lifetable class and the actuarialtable class. The lifetable class is dened as follows R> #definition of lifetable R> showClass("lifetable") Class "lifetable" [package "lifecontingencies"] Slots: Name: Class: x numeric

lx name numeric character

Known Subclasses: "actuarialtable"

Class actuarialtable inherits from lifetable class and has another additional slots,the interest rate.

Dr
R> showClass("actuarialtable") Slots: Name: Class: interest numeric x numeric Extends: "lifetable"

Class "actuarialtable" [package "lifecontingencies"]

Beyond generic S4 classes and method there are three groups of functions: demographics, nancial mathematics and life contingencies analysis functions. The demographic group comprises the following functions: 1. dxt returns deaths between age x and x + t, dx,t . 2. pxt returns survival probability between age x and x + t, px,t .

af t
lx name numeric character

A package to evaluate actuarial present values 3. pxyt returns the survival probability for two lifes, dxy,t . 4. qxt returns death probability between age x and x + t, qx,t . 5. qxyt returns the survival probability for two lifes, qxy,t . 6. Txt returns the number of person-years lived after exact age x, Tx,t . 7. mxt returns central mortality rate, mx,t . 8. exn returns the complete or curtate expectation of life from age x to x + n, ex,n . 9. rLife returns a sample from the time until death distribution underlying a life table. 10. exyt returns the expected life time for two lifes between age x and x + t. 11. probs2lifetable returns a life table lx from raw one - year survival / death probabilities.

The nancial mathematics group comprises the following functions, for which we report most important function: 1. presentValue returns the present value for a series of cash ows. 2. annuity returns the present value of a annuity - certain, an .

3. iecreasingAnnuity returns the present value of an increasing annuity - certain, (IA)n . 4. accumulatedValue returns the future value of a series of cash ows, sn .

5. decreasingAnnuity returns the present value of an increasing annuity, (DA)n .

Dr
1. Axn returns the APV for life insurances. 3. axn returns the APV for annuities. 4. axyn returns the APV for two heads annuities.

6. accumulatedValue returns the future value of a payments sequence, sn .

7. nominal2Real returns the eective annual interest (discount) rate i given the nominal m-periodal interest i( m) or discount dm rate.

8. real2Nominal returns the m-periodal interest or discount rate given the m periods or the discount. 9. intensity2Interest returns the intensity of interest given the interest rate i.

10. interest2Intensity returns the interest rate i given the intensity of interest .

The actuarial mathematics group comprises the following functions, for which we report must important function:

2. Axyn returns the APV for two heads life insurances.

af t

Giorgio Alfredo Spedicato 5. Exn returns the APV for the pure endowment. 6. Iaxn returns the APV fof the increasing annuity. 7. IAxn returns the APV fof the increasing life insurance. 8. DAxn returns the APV for the decreasing life insurance.

Dr

af t

A package to evaluate actuarial present values

4. Code and examples


4.1. Classical nancial mathematics example
The lifecontingencies package provides functions to perform classical nancial analysis. Following examples will show how to handle interest and discount rates with dierent compounding frequency, how to perform present value, annuities and future values analysis calculations, loans amortization and bond pricing.

Interest rate functions


Following examples show how to switch from im i R> #an APR of 3% is equal to a R> real2Nominal(0.03,12) [1] 0.02959524

R> #of nominal interest rate while R> #6% annual nominal interest rate is the same of R> nominal2Real(0.06,12) [1] 0.06167781

R> #APR R> #4% per year compounded quarterly is R> nominal2Real(0.04,4) [1] 0.04060401

Dr
[1] 3.941363 and from dm d [1] 0.04075264

R> #4% effective interest rate corresponds to R> real2Nominal(0.04,4)*100

R> #nominal interest rate (in 100s) compounded quarterly

R> #a nominal rate of discount of 4% payable quarterly is equal to a R> real2Nominal(i=0.04,m=12,type="discount")

Present value analysis


Performing a project appraisal means evaluating the present value of all net cash ows, as shown in code below:

af t

Giorgio Alfredo Spedicato R> R> R> R> R> R> + #suppose an investment requires and grants following cash flows capitals=c(-1000,200,500,700) #at time (vector) t. times=c(-2,-1,4,7) #the preset value of the investment is presentValue(cashFlows=capitals, timeIds=times, interestRates=0.03)

[1] 158.5076 R> #assuming 3% interest rate R> R> #while if interest rates were time - varying R> #e.g. 0.04 0.02 0.03 0.057 R> presentValue(cashFlows=capitals, timeIds=times, + interestRates=c( 0.04, 0.02, 0.03, 0.057)) [1] 41.51177 R> R> R> + +

#and if the last cash flow is uncertain, as we assume a #receiving probability of 50% presentValue(cashFlows=capitals, timeIds=times, interestRates=c( 0.04, 0.02, 0.03, 0.057), probabilities=c(1,1,1,0.5))

[1] -195.9224

Dr
Annuities and future values
[1] 388.9651 R> #while the corresponding future values is R> 100*accumulatedValue(i=0.09,n=5) [1] 598.4711 R> R> R> R> R> R>

Example of a n| and s n| evaluations are reported below. R> #PV annuity immediate 100$ each year 5 years @9% R> 100*annuity(i=0.09,n=5)

#A man wants to save 100,000 to pay for the education #of his son in 10 years time. An education fund requires the investors to #deposit equal instalments annually at the end of each year. If interest of #0.075 is paid, how much does the man need to save each year (R) in order to #meet his target? 100000/accumulatedValue(i=0.075,n=10)

af t

10 [1] 7068.593

A package to evaluate actuarial present values

while the code below shows how fractional annuities (alcroof n ) can be handled within annuity and accumulatedValue functions. R> R> R> R> R> R> #Find the present value of an annuity-immediate of #100 per quarter for 4 years, if interest is compounded semiannually at #the nominal rate of 6%. #the APR is APR=nominal2Real(0.06,2) 100*4*annuity(i=APR,n=4,m=4)

(m)

[1] 1414.39 Finally increasingAnnuity and decreasingAnnuity functions handle increasing ((IA)x ) and decreasing ((DA)x ) annuities. R> R> R> R> R> R> #An increasing n-payment annuity-due shows payments of 1, 2, #... , n #at time 0, 1, ... , #n - 1 . At interest rate of #0.03 and n=10, its present value of the annuity is increasingAnnuity(i=0.03, n=10,type="due")

[1] 46.18416 R> R> R> R>

Dr
[1] 48.99324 R> R> R> R> R> R> [1] 9.48612

#while the present value of a decreasing #annuity due of 10, 9,...,1 #from time 1 to time 10 is decreasingAnnuity(i=0.03, n=10,type="immediate")

Finally the calculation of the present value of a geometrically increasing annuity is shown in the code below #assume each year the annuity increases its value by 3% #while the interest rate is 4% #first determine the effective interest rate ieff=(1+0.04)/(1+0.03)-1 #assume the annuity lasts 10 years annuity(i=ieff,n=10)

af t

Giorgio Alfredo Spedicato

11

Loan amortization
The code lines below show how an investment amortization schedule will be repaired. Suppose loaned capital is C , then assuming an interest rate i, the amount due to the lender at each instalment is R = aC .
n|

At each installment the Rt installment repays It = Ct1 i as interest and Ct = Rt It as capital. R> R> R> R> R> R> R>

[1] 11407.88 R> R> R> R> + + + +

#compute the balance due at the begin of period balance_due=numeric(years*payments_per_year) balance_due[1]=capital*(1+rate_per_period)-installment for(i in 2:length(balance_due)) { balance_due[i]=balance_due[i-1]*(1+rate_per_period)-installment cat("Payment ",i, " balance due:",round(balance_due[i]),"\n") } 2 3 4 5 6 7 8 9 10 balance due: 81903 balance due: 72517 balance due: 62900 balance due: 53046 balance due: 42948 balance due: 32600 balance due: 21998 balance due: 11133 balance due: 0

Dr
Payment Payment Payment Payment Payment Payment Payment Payment Payment

Bond pricing
Bond pricing is another application of present value analysis. A standard bond whose principal will be repaid at time T is a series of coupon ct , priced according to a coupon rate j ( k ) on a principal C . Formula 7 expresses the present value of a bond. Bt = ct a(k) n| + Cv T We will show how to evaluate a standard bond with following examples: (7)

af t

capital=100000 interest=0.05 #assume 5% effective annual interest payments_per_year=2 #payments per year rate_per_period=(1+interest)^(1/payments_per_year)-1 years=5 #five years length of the loan installment=1/payments_per_year*capital/annuity(i=interest, n=years,m=payments_per_year installment

12 R> + + + + + + + + + + + R> R>

A package to evaluate actuarial present values

bond<-function(faceValue, couponRate, couponsPerYear, yield,maturity) { out=NULL numberOfCF=maturity*couponsPerYear #determine the number of CF CFs=numeric(numberOfCF) payments=couponRate*faceValue/couponsPerYear #determine the coupon sum cf=payments*rep(1,numberOfCF) cf[numberOfCF]=faceValue+payments #set the last payment amount times=seq.int(from=1/couponsPerYear, to=maturity, by=maturity/numberOfCF) out=presentValue(cashFlows=cf, interestRates=yield, timeIds=times) return(out) } #bond coupon rate 6%, two coupons per year, face value 1000, yield 5%, three years to m bond(1000,0.06,2,0.05,3)

[1] 1029.25

R> #bond coupon rate 3%, one coupons per year, face value 1000, yield 3%, three years to m R> bond(1000,0.06,1,0.06,3) [1] 1000

Dr

af t

Giorgio Alfredo Spedicato

13

4.2. Lifetables and actuarial tables analysis


lifetable classes represent the basic class designed to handle life table calculations. A actuarialtable class inherits from lifetable class adding one more slot to set the a priori rate of interest. Both classes have been designed using the S4 class framework. Examples follow showing how lifetable and actuarialtable objects initialization, basic survival probability and life tables analysis.

Creating lifetable and actuarialtable objects


Lifetable objects can be created by raw R commands or using existing data.frame objects. However, to build a lifetable class object three items are needed: 1. The years sequence, that is an integer sequence 0, 1, . . . , . It shall starts from zero and going to the age (the age x that px = 0). 2. The lx vector, that is the number of subjects living at the beginning of age x. 3. The name of the life table.

R> x_example=seq(from=0,to=9, by=1) R> lx_example=c(1000,950,850,700,680,600,550,400,200,50) R> fakeLt=new("lifetable",x=x_example, lx=lx_example, name="fake lifetable") A print (or show ) method are available. These methods report the x, lx, px and ex in tabular form.

Dr
R> print(fakeLt) Life table fake lifetable 1 2 3 4 5 6 7 8 9 x lx px ex 0 1000 0.9500000 4.742105 1 950 0.8947368 4.241176 2 850 0.8235294 4.042857 3 700 0.9714286 3.147059 4 680 0.8823529 2.500000 5 600 0.9166667 1.681818 6 550 0.7272727 1.125000 7 400 0.5000000 0.750000 8 200 0.2500000 0.500000 head and tail methods for data.frame S3 classes have also been adapted to lifetable classes, as code below shows. R> #show head method R> head(fakeLt)

af t

14 x lx 0 1000 1 950 2 850 3 700 4 680 5 600

A package to evaluate actuarial present values

1 2 3 4 5 6

R> #show tail method R> tail(fakeLt) x 4 5 6 7 8 9 lx 680 600 550 400 200 50

Nevertheless the easiest way to create a lifetable object is starting from a suitable existing data.frame. R> R> R> R> R> R> R> R> R> R> R> R> R> R> R> R> R> R> R> R> R> R> R> R> R> R> #load USA Social Security LT data(demoUsa) usaMale07=demoUsa[,c("age", "USSS2007M")] usaMale00=demoUsa[,c("age", "USSS2000M")] #coerce from data.frame to lifecontingencies requires x and lx names names(usaMale07)=c("x","lx") names(usaMale00)=c("x","lx") #apply coerce methods and changes names usaMale07Lt<-as(usaMale07,"lifetable") usaMale07Lt@name="USA MALES 2007" usaMale00Lt<-as(usaMale00,"lifetable") usaMale00Lt@name="USA MALES 2000" #create the tables ##males lxIPS55M<-with(demoIta, IPS55M) pos2Remove<-which(lxIPS55M %in% c(0,NA)) lxIPS55M<-lxIPS55M[-pos2Remove] xIPS55M<-seq(0,length(lxIPS55M)-1,1) ##females lxIPS55F<-with(demoIta, IPS55F) pos2Remove<-which(lxIPS55F %in% c(0,NA)) lxIPS55F<-lxIPS55F[-pos2Remove] xIPS55F<-seq(0,length(lxIPS55F)-1,1) #finalize the tables ips55M=new("lifetable",x=xIPS55M, lx=lxIPS55M, name="IPS 55 Males") ips55F=new("lifetable",x=xIPS55F, lx=lxIPS55F, name="IPS 55 Females")

Dr

af t

5 6 7 8 9 10

Giorgio Alfredo Spedicato

15

The last way a lifetable object can be created is generating it from one year survival or death probabilities. Such probabilities could be obtained from mortality projection methods (e.g. Lee - Carter). R> R> R> R> R> #use 2002 Italian males life tables data(demoIta) itaM2002<-demoIta[,c("X","SIM92")] names(itaM2002)=c("x","lx") itaM2002Lt<-as(itaM2002,"lifetable")

removing NA and 0s R> R> R> R> R> R> R> R> R>

An actuarialtable class inherits from the lifecontingencies class, but it contains and additional slot: the interest rate slot. slot.

Dr
R> R> + Method getOmega provides the age. R> getOmega(fakeAct) [1] 9

#assume 3% interest rate fakeAct=new("actuarialtable",x=fakeLt@x, lx=fakeLt@lx, interest=0.03, name="fake actuarialtable")

Method print behaves dierently between lifetable objects and actuarialtable objects. One year survival probability and complete expected remaining life until deaths is reported when print method is applied on a lifetable object. Classical commutation functions (Dx , Nx , Cx , Mx , Rx ) are reported when print method is applied on an actuarialtable object. R> #apply method print applied on a life table R> print(fakeLt)

af t

itaM2002Lt@name="IT 2002 Males" #reconvert in data frame itaM2002<-as(itaM2002Lt,"data.frame") #add qx itaM2002$qx<-1-itaM2002$px #reduce to 20% one year death probability for ages between 20 and 60 for(i in 20:60) itaM2002$qx[itaM2002$x==i]=0.2*itaM2002$qx[itaM2002$x==i] #otbain the reduced mortality table itaM2002reduced<-probs2lifetable(probs=itaM2002[,"qx"], radix=100000,type="qx",

16

A package to evaluate actuarial present values

Life table fake lifetable x lx px ex 0 1000 0.9500000 4.742105 1 950 0.8947368 4.241176 2 850 0.8235294 4.042857 3 700 0.9714286 3.147059 4 680 0.8823529 2.500000 5 600 0.9166667 1.681818 6 550 0.7272727 1.125000 7 400 0.5000000 0.750000 8 200 0.2500000 0.500000

1 2 3 4 5 6 7 8 9

Actuarial table

fake actuarialtable interest rate

Dr
Basic demographic calculations
[1] 0.9995951 [1] 0.001332031

1 2 3 4 5 6 7 8 9 10

x lx Dx Nx Cx Mx Rx 0 1000 1000.00000 5467.92787 48.54369 840.7400 4839.7548 1 950 922.33010 4467.92787 94.25959 792.1963 3999.0148 2 850 801.20652 3545.59778 137.27125 697.9367 3206.8185 3 700 640.59916 2744.39125 17.76974 560.6654 2508.8819 4 680 604.17119 2103.79209 69.00870 542.8957 1948.2164 5 600 517.56527 1499.62090 41.87421 473.8870 1405.3207 6 550 460.61634 982.05563 121.96373 432.0128 931.4337 7 400 325.23660 521.43929 157.88185 310.0491 499.4210 8 200 157.88185 196.20268 114.96251 152.1672 189.3719 9 50 38.32084 38.32084 37.20470 37.2047 37.2047

Basic probability calculations may be performed on valid lifetable or actuariatable objects. Below calculations for t px , t qx and e x :n . R> #using ips55M life table R> #probability to survive one year, being at age 20 R> pxt(ips55M,20,1)

R> #probability to die within two years, being at age 30 R> qxt(ips55M,30,2)

af t
3 %

R> #apply method print applied on an actuarial table R> print(fakeAct)

Giorgio Alfredo Spedicato R> #expected life time between 50 and 70 years R> exn(ips55M, 50,20) [1] 19.43322 Fractional survival probabilities can also be calculated according with linear interpolation, constant force of mortality and hyperbolic assumption.

17

R> data(soa08Act) #load Society of Actuaries illustrative life table R> pxt(soa08Act,80,0.5,"linear") #linear interpolation (default) [1] 0.9598496 R> pxt(soa08Act,80,0.5,"constant force") #constant force [1] 0.9590094

R> pxt(soa08Act,80,0.5,"hyperbolic") #hyperbolic Balducci's assumption. [1] 0.9581701

Analysis of two heads survival probabilities can be performed also, as shown by code below: R> pxyt(fakeLt,fakeLt,x=6, y=7, t=2) #joint survival probability

Dr
[1] 0.04545455 [1] 0.4431818 [1] 19.1983

R> pxyt(fakeLt,fakeLt,x=6, y=7, t=2,status="last") #last survival probability

R> #evaluate the expected joint life time for a couple aged 65 and 63 using Italina IPS55 R> exyt(ips55M, ips55F, x=65,y=63, status="joint")

4.3. Classical actuarial mathematics examples


Classical actuarial mathematics on life contingencies will follow now. We will use the SOA illustrative life table on all following examples.

Life insurance examples


Following examples show the APV (i.e. the lump sum benet premium) for:

af t

18

A package to evaluate actuarial present values


1 1. 10-year term life insurance for a subject aged 30 assuming 4% interest rate, A30:10 .

2. 10-year term life insurance for a subject aged 30 with benet payable at the end of month of death at 4% interest rate. 3. whole life insurance for a subject aged 40 assuming 4% interest rate, A40 . 4. 5 years deferred 10-years term life insurance for a subject aged 40 assuming 5% interest 40 . rate, 5|10 A 5. 5 years annually decreasing term life insurance for a subject aged 50 assuming 6% 1 . interest rate, (DA)50:5
1 . 6. 20 years increasing term life insurance, age 40, (IA)50:5

[1] 0.01577283

R> #same as above but payable at the end of month of death R> Axn(soa08Act, x=30,n=10,i=0.04,k=12) [1] 0.01605995

R> #a whole life for a 40 years old insured at @4% is R> Axn(soa08Act, 40) #soa08Act has 6% implicit interest rate

Dr
[1] 0.1613242 [1] 0.03298309 [1] 0.08575918 [1] 0.1551456

R> #a 5-year deferred life insurance, 10 years length, 40 years age, @5% interest rate R> Axn(soa08Act, x=40,n=10,m=5,i=0.05)

R> #Five years annually decreasing term life insurance, age 50. R> DAxn(soa08Act, 50,5)

R> #Increasing 20 years term life insurance, age 40 R> IAxn(soa08Act, 40,10)

while following code evaluates pure endowments APV, n Ex , assuming SOA life table at 6% interest rate.

af t

R> #The APV of a life insurance for a 10-year term life insurance for an R> #insured aged 40 @ 4% interest rate is R> Axn(soa08Act, 30,10,i=0.04)

Giorgio Alfredo Spedicato R> #evaluate the APV for a n year pure endowment, age x=30, n=35, i=6% R> Exn(soa08Act, x=30, n=35, i=0.06) [1] 0.1031648 R> #try i=3% R> Exn(soa08Act, x=30, n=35, i=0.03) [1] 0.2817954

19

Life annuities examples


Following examples show annuities APV calculations for

2. annuity due for a subject aged 65, a 65 .

3. 20 years annuity due with monthly fractional payments of $1000, a 65:20 . All examples assume SOA life table at 6% interest rate.

R> #assuming insured's age x=65 and SOA illustrative life table @6% hold for all examples R> #annuity immediate R> axn(soa08Act, x=65, m=1) [1] 8.896928

Dr
R> #annuity due R> axn(soa08Act, x=65) [1] 9.896928 [1] 113179.1 [1] 108223.5 [1] 107321.1

R> #due with monthly payments of $1000 provision R> 12*1000*axn(soa08Act, x=65,k=12)

R> #due with montly payments of $1000 provision, 20 - years term R> 12*1000*axn(soa08Act, x=65,k=12, n=20)

R> #immediate with monthly payments of 1000 provision, 20 - years term R> 12*1000*axn(soa08Act, x=65,k=12,n=20,m=1/12)

af t
(12)

1. annuity immediate for a subject aged 65, a65 .

20

A package to evaluate actuarial present values

Benet premiums examples


lifecontingencies package functions can be used to evaluate benet premium for life contin1 x :h . gencies, using the formula h P x :n = AP V a R> R> R> R> R> data(soa08Act) #use SOA MLC exam illustrative life table #Assume X, aged 30, whishes to buy a 250K 35-years life insurance #premium paid annually for 15 years @2.5%. Pa=100000*Axn(soa08Act, x=30,n=35,i=0.025)/axn(soa08Act, x=30,n=15,i=0.025) Pa

[1] 921.5262 R> #if premium is paid montly R> Pm=100000*Axn(soa08Act, x=30,n=35,i=0.025)/axn(soa08Act, x=30,n=15,i=0.025,k=12) R> Pm [1] 932.9836 R> R> R> R>

#level semiannual premium for an endowment insurance of 10000 #insured age 50, insurance term is 20 years APV=10000*(Axn(soa08Act,50,20)+Exn(soa08Act,50,20)) P=APV/axn(soa08Act,50,20,k=2)

Benet reserves examples

Dr
The benet premium is P , determined from equation R> R> At At At At At At At At time time time time time time time time 0 1 2 3 4 5 6 7 benefit benefit benefit benefit benefit benefit benefit benefit reserve reserve reserve reserve reserve reserve reserve reserve is is is is is is is is 0 306.9663 604.0289 889.0652 1159.693 1413.253 1646.808 1857.044

Now we will evaluate the benet reserve for a 20 year life insurance of 100,000, whith benets payable at the end of year of death, whith level benet premium payable at the beginning of each year. Assume 3% of interest rate and SOA life table to apply.

1 1 . The benet reserve is k V 40+ = 100000A40+ Pa 40+t:20t for t = 0 . . . 19. t:nt t:20t

P=100000*Axn(soa08Act,x=40,n=20,i=0.03)/axn(soa08Act,x=40,n=20,i=0.03) for(t in 0:19) cat("At time ",t," benefit reserve is ", 100000*Axn(soa08Act,x=4

af t
1 Pa 40:20 = 100000A40:20

Giorgio Alfredo Spedicato At At At At At At At At At At At At time time time time time time time time time time time time 8 benefit reserve is 2040.286 9 benefit reserve is 2192.436 10 benefit reserve is 2308.88 11 benefit reserve is 2384.513 12 benefit reserve is 2413.576 13 benefit reserve is 2389.633 14 benefit reserve is 2305.464 15 benefit reserve is 2152.963 16 benefit reserve is 1922.973 17 benefit reserve is 1605.162 18 benefit reserve is 1187.872 19 benefit reserve is 657.8482

21

The benet reserve for a whole life annuity with level annual premium is k V (n| a x ), that equals x P (n| a x ) ax+k:nk when x . . . n, a x+k otherwise. The gure is shown in 1. n| a

Dr
Figure 1: Benet reserve of a 65

af t

22

A package to evaluate actuarial present values

Insurance and annuities on two heads


Lifecontingencies package provides functions to evaluate life insurance and annuities on two lifes. Following examples will check the equality axy = ax + ay axy . R>

axn(soa08Act, x=65,m=1)+axn(soa08Act, x=70,m=1)-axyn(soa08Act,soa08Act, x=65,y=

[1] 10.35704 R> axyn(soa08Act,soa08Act, x=65,y=70, status="last",m=1)

[1] 10.35704 Reversionary annuity (annuities payable to life y upon death of x), ax|y = ay axy can also be evaluate using lifecontingencies functions. R> R> #assume x aged 65, y aged 60 axn(soa08Act, x=60,m=1)-axyn(soa08Act,soa08Act, x=65,y=60,status="joint",m=1)

[1] 2.695232

Dr

af t

Giorgio Alfredo Spedicato

23

4.4. Stochastic analysis


This last paragraphs will show some stochastic analysis that can be performed by our package, both in demographic analysis and life insurance evaluation. The age-until-death, both in the continuous (Tx ) or curtate form (Kx ), is a stochastic variable whose distribution is implicit within the deaths distribution of a given life table. The code below shows how to sample values from the age-until-death distribution implicit in the SOA life table. R> R> R> R> R> data(soa08Act) #sample 10 numbers from the Tx distribution sample1<-rLife(n=10,object=soa08Act,x=0,type="Tx") #sample 10 numbers from the Kx distribution sample1<-rLife(n=10,object=soa08Act,x=0,type="Kx")

while code below shows how the mean of the sampled distribution is statistically equivalent to the expected life time. R> R> R> #assume an insured aged 29 #his expected integer number of years until death is exn(soa08Act, x=29,type="curtate")

[1] 45.50066 R> R>

Dr
[1] 0.6378775 R> #statistically not significant

#check if we are sampling from a statistically equivalent distribution t.test(x=rLife(2000,soa08Act, x=29,type="Kx"),mu=exn(soa08Act, x=29,type="curta

Finally gure 2 shows the deaths distribution implicit in the ips55M life table. The APV is a present value of a random variable that represents a composite function between the discount amount and indicator variables regarding the life status of the insured. Figure 3 shows the stochastic distribution of a 65 .

The lifecontingencies package allows actuaries to perform nancial and life contingencies actuarial mathematics within R. It oers the basic tools to manipulate life tables and perform nancial calculations. Pricing, reserving and stochastic evaluation of most important life insurance contract can be performed within R. Future work spans in multiple directions. Currently lifecontingencies handles only one - year life tables and single causes of decrement only. We expect to make the package more esible

af t
5. Discussion

24

A package to evaluate actuarial present values

Dr

Figure 2: Deaths distribution implicit in the IPS55 males table

from this side. The stochastic calculation modules will be improved, morover. Similarly we expect to integrate C++ fragments using Rcpp package whether it eectively improves performance. Finally we wish to provide lifecontingencies coerce methods toward packages specialized in demographic analysis, like demography and LifeTables and interest rates modelling.

The accuracy of calculation have been veried by checkings with numerical examples reported in Bowers et al. (1997). The package numerical results are identical to those reported in the Bowers et al. (1997) for most function, with the exception of fractional payments annuities where the accuracy leads only to the 5th decimal. The reason of such inaccuracy is due to the fact that the package calculates the APV by directly sum of fractional survival probabilities, while the formulas reported in Bowers et al. (1997) uses an analytical formula.

af t
Disclaimer

Giorgio Alfredo Spedicato

25

Dr

af t
Figure 3: Stochastic distribution of a 65

26

A package to evaluate actuarial present values

Acknowledgments
I wish to thank Christophe Dutang and Tim Rie for their valuable suggestions.

References
Bowers N, Gerber H, Hickman J, Jones D, Nesbitt C (1997). Actuarial Mathematics. Schaumburg. IL: Society of Actuaries, pp. 7982. Broverman S (2008). Mathematics of investment and credit. ACTEX academic series. ACTEX Publications. ISBN 9781566986571. URL http://books.google.it/books?id= lK5WDvdc7TcC.

Dutang C, Goulet V, Pigeon M (2008). actuar: An R Package for Actuarial Science. Journal of Statistical Software, 25(7), 38. URL http://www.jstatsoft.org/v25/i07. Gesmann M, Zhang Y (2011). ChainLadder: Mack, Bootstrap, Munich and Multivariatechain-ladder Methods. R package version 0.1.4-3.4. Keytz N, Caswell H (2005). Applied mathematical demography. Statistics for biology and health. Springer. ISBN 9780387225371. URL http://books.google.it/books?id= PxSVxES7Sj0C.

Dr

Klugman S, Panjer H, Willmot G, Venter G (2009). Loss models: from data to decisions. Third edition. Wiley New York. Rie T (2011). LifeTable: LifeTable, a package with a small set of useful lifetable functions. R package version 1.0.1, URL http://sites.google.com/site/timriffepersonal/ r-code/lifeable.

Rigby RA, Stasinopoulos DM (2005). Generalized additive models for location, scale and shape,(with discussion). Applied Statistics, 54, 507554.

Rob J Hyndman, Heather Booth, Leonie Tickle, John Maindonald (2011). demography: Forecasting mortality, fertility, migration and population data. R package version 1.09-1, URL http://CRAN.R-project.org/package=demography. Ruckman C, Francis J (????). FINANCIAL MATHEMATICS:A Practical Guide for Actuaries and other Business Professionals. Zhang W (2011). cplm: Monte Carlo EM algorithms and Bayesian methods for tting Tweedie compound Poisson linear models. R package version 0.2-1, URL http://CRAN.R-project. org/package=cplm.

af t

Chambers J (2008). Software for data analysis: programming with R. Statistics and computing. Springer. ISBN 9780387759357. URL http://books.google.com/books?id= UXneuOIvhEAC.

Giorgio Alfredo Spedicato

27

Aliation:
Giorgio Alfredo Spedicato StatisticalAdvisor Inc. Via Firenze 11 20037 Italy Telephone: +39/334/6634384 E-mail: [email protected] URL: www.statisticaladvisor.com

Dr

af t

You might also like