SlideShare a Scribd company logo
1 of 34
Download to read offline
Annuities Modeling with R
Giorgio Alfredo Spedicato, Ph.D C.Stat ACAS
29th June 2015
Intro
The use of lifecontingencies R package (Spedicato 2013) to evaluate
annuities will be introduced.
lifecontingencies package provides a broad set of tools to perform actuarial
calculations on life insurances. It requires a recent version of R (>=3.0),
the markovchain package (Giorgio Alfredo Spedicato 2015) and Rcpp
(Eddelbuettel 2013).
This presentation is focused on actuarial evaluation of annuities present
value distribution from the perspective of a Pension Fund.
As a memo, the present value of a life annuity on a policyholder aged x is a
random variable that depends on the future lifetime, Kx , future cash flows
cj and future (real) discount factors vj =
1+rj
1+ij
− 1.
It can be written as ¨aKx +1
=
Kx
j=0
vj
∗ cj .
Therefore it is a function of three random variables: the residual life time,
Kt , the nominal (future) rates of interest, rt , and the (future) inflation rates
it , where t ∈ 0, 1
k
, . . . , Kt , .
We will calculate APV from a classical central baseline scenario (defined life
table and fixed financials hyphotheses). We will then allow for variability on
these hyphoteses.
In particular we will allow for process and parameter variance on the
demographical side of calculation. Stochastic interest rate and inflation
scenarios will be simulated as well.
Slides will contain key code snippets, figures and tables. The dedicated
repository (https://bitbucket.org/spedygiorgio/rininsurance2015)
collect the full code needed to replicate the results.
Collecting data
Collecting Financial from FRED
We will retrieve economics from Federal Reserve Economic Data using
quantmod package (Ryan 2015).
Demographic tables used to project life tables will come from Human
Mortality Database (University of California and Demographic Research
2015).
#retrieving Italian financial data from FRED
library(quantmod)
getSymbols(Symbols = 'ITACPIALLMINMEI',src='FRED') #CPI
getSymbols(Symbols='IRLTLT01ITM156N',
src='FRED') #Nominal IR (10Y Bond Yield)
we can observe a certain degree of structural dependency between i and r,
that suggests the use of cointegration analysis for modeling.
0%
5%
10%
15%
0%
5%
10%
15%
BondYield10YInflation
1990 1995 2000 2005 2010 2015
month
rate
Italian Inflation and Nominal Interest Rates since 1991
Collecting demographics from HMD
Retrieving data from Human Mortality Database (HMD) is easy as well
library(demography)
italyDemo<-hmd.mx("ITA", username="yourUN",
password="yourPW")
0 20 40 60 80 100
−10−8−6−4−202
Italy: total death rates (1872−2009)
Age
Logdeathrate
Defining baseline actuarial hyphotheses
Our baseline hyphoteses are:
retiree age: x = 65, cohort 1950.
yearly pension benefit: 1, CPI indexed.
frequency of payment of 1
k
payments k = 12.
mortality model: Lee Carter.
no survivors benefit: no reversionary annuity component.
only one interest rate (r): 10 year governemnt bond yield.
Baseline inflation (i) and nominal interest rate (r) calculated as straight
average of 10 Years values between 1999 and 2014 (Euro Currency Era).
This yields a real discount factor around 2.4%.
xts package (Ryan and Ulrich 2014) functions have been used to calculate
baseline figures.
#use xts functions to calculate yearly averages
finHyph<-apply(apply.yearly(x =
italy.fin["1999/2014",2:1], FUN="mean"),2,"mean")
infl<-finHyph[1];nomRate<-finHyph[2]
realRate<-(1+nomRate)/(1+infl)-1
names(realRate)<-"RealRate"
c(nomRate, infl, realRate)
## BondYield10Y Inflation RealRate
## 0.04520074 0.02073512 0.02396862
Projecting mortality
Mortality dynamics will follow Lee Carter model (Lee and Carter 1992):
qx,t = eax +bx ∗kt +εx,t
,
We will start projecting a central scenario for mortality on which a baseline
life table can be derived for the 1950 cohort.
demography (Rob J Hyndman et al. 2011) and forecast (Hyndman and
Khandakar 2008) packages calibrate and perform Lee Carter’ model
projections respectively.
historical and projected KT
year
kt
1900 1950 2000 2050 2100
−300−200−1000100
-The code below generates the matrix of prospective life tables
#getting and defining the life tables matrix
mortalityTable<-exp(italy.leecarter$ax+
italy.leecarter$bx%*%t(kt.full))
rownames(mortalityTable)<-seq(from=0, to=103)
colnames(mortalityTable)<-seq(from=1872,
to=1872+dim(mortalityTable)[2]-1)
The function below returns the yearly death probabilities for a given birth
cohort.
getCohortQx<-function(yearOfBirth)
{
colIndex<-which(colnames(mortalityTable)
==yearOfBirth) #identify
#the column corresponding to the cohort
#definex the probabilities from which
#the projection is to be taken
maxLength<-min(nrow(mortalityTable)-1,
ncol(mortalityTable)-colIndex)
qxOut<-numeric(maxLength+1)
for(i in 0:maxLength)
qxOut[i+1]<-mortalityTable[i+1,colIndex+i]
#fix: we add a fictional omega age where
#death probability = 1
qxOut<-c(qxOut,1)
return(qxOut)
}
Now we can get a baseline projected life table for a 1950 born.
#generate the life tables
qx1950<-getCohortQx(yearOfBirth = 1950)
lt1950<-probs2lifetable(probs=qx1950,type="qx",
name="Baseline")
at1950Baseline<-new("actuarialtable",x=lt1950@x,
lx=lt1950@lx,interest=realRate)
0 20 40 60 80 100
0200040006000800010000
life table Generic life table
x values
populationatrisk
Variability assessment
Process variance
It is now easy to assess the expected curtate lifetime, ˚e65 and the APV of
the annuity ¨a12
65, for x = 65.
#curtate lifetime @x=65
ex65.base<-exn(object = at1950Baseline,x = 65)
names(ex65.base)<-"ex65"
#APV of an annuity, allowing for fractional payment
ax65.base<-axn(actuarialtable = at1950Baseline,
x=65,k = 12);names(ax65.base)<-"ax65"
c(ex65.base,ax65.base)
## ex65 ax65
## 18.72669 14.95836
It is possible to simulate the process variance (due to “pure” chance on
residual life time) of both Kt and ¨aKx +1
=
Kx
j=0
vj
∗ cj .
#simulate curtate lifetime
lifesim<-rLife(n=1e4,object=at1950Baseline,x=65,k=12,type = "Kx")
c(mean(lifesim),sd(lifesim))
## [1] 19.057092 8.263257
#simulate annuity present value
annuitysim<-rLifeContingencies(n=1e4,lifecontingency="axn",
object=at1950Baseline,x=65,k=12,parallel=TRUE)
c(mean(annuitysim),sd(annuitysim))
## [1] 14.943719 5.548229
0.00
0.01
0.02
0.03
0.04
0.05
0 10 20 30 40
Kt
density Remaining lifetime
0.00
0.02
0.04
0.06
0.08
0 10 20
APV
density
Annuity Actuarial Present Value simulation
Process Variance simulation
Stochastic life tables
Estimation variance due to the demographic component arises from
uncertainty in demographic assumption (stochastic life tables).
We take into account this source of variability generating random life tables
by randomizing kt projections and by sampling from εx,t on the Lee Carter
above mentioned formula.
The code that follows integrates the simulation of parameter and process
variance on the demographic component.
###nesting process variance and parameter variance
numsim.parvar=31
numsim.procvar=31
### simulating parameter variance
tablesList<-list()
for(i in 1:numsim.parvar) tablesList[[i]] <-
tableSimulator(lcObj = italy.leecarter,
kt.model = italy.kt.model,
coort = 1950,
type = 'simulated',
ltName = paste("table",i),
rate=realRate
)
### simulating process variance
lifesim.full<-as.numeric(sapply(X=tablesList, FUN="rLife",n=numsim.procv
annuitysim.full<-as.numeric(sapply(X=tablesList, FUN="rLifeContingencies
Varying financial assumptions
Changing nominal interest rate assumption
We assume only one financial asset: 10 years Gvt Bond.
Interest rate dynamic follows a Vasicek model,
drt = λ ∗ (rt − µ) ∗ dt + σ ∗ dWt .
Therefore parameters can be estimated by least squares from the equation
St = a ∗ St−1 + b + εt , as shown below. We have used the approach shown
in http://www.sitmo.com/article/
calibrating-the-ornstein-uhlenbeck-model/.
λ = −
lna
δ
µ =
b
1 − a
σ = sd(ε) −
2 ∗ ln (a)
δ ∗ (1 − a2)
The function that follows calibrates the Vasicek interest rate mode on
Italian data since 1991.
calibrateVasicek<-function(x, delta=1) {
y<-as.zoo(x)
x<-lag(y,-1,na.pad=TRUE)
myDf<-data.frame(y=y,x=x)
linMod <- lm(y~x,data=myDf)
a<-coef(linMod)[2]
b<-coef(linMod)[1]
lambda<- as.numeric(-log(a)/delta)
mu <- as.numeric(b/(1-a))
sigma <- as.numeric(((-2*log(a))/(delta*(1-a^2)))^.5*sd(linMod$residu
out<-list(lamdba=lambda, mu=mu, sigma=sigma)
return(out)
}
The calibrated parameters follows. However the long term average has been
judgmentally fixed to 4.52%.
They will be used to simulate Vasicek - driven interest rates paths.
#calibrate
italianRatesVasicek<-calibrateVasicek(x =as.numeric(italy.fin[,1]),
delta=1/12)
italianRatesVasicek
## $lamdba
## [1] 0.1129055
##
## $mu
## [1] 0.01704393
##
## $sigma
## [1] 0.0102649
#simulate
randomInterestRateWalk<-ts(VasicekSimulations(M = 1,N = 40*12,r0 = 0.04,
italianRatesVasicek$sigma ,dt = 1/12)[,1],start=c(2015,4),frequency=12)
One Vasicek interest rate walk
month
nominalinterestrate
2020 2030 2040 2050
0.000.020.040.060.080.10
Modeling inflation dynamic
The dependency between nominal rates and inflation is well know.
Cointegration analysis is needed to avoid spurious regression.
We have assumed the their relationship to be linear inft = α + β ∗ rt + γt .
Cointegration analysis on annualized data was peformed using package vars
(Pfaff 2008). One cointegrating relationship was found to be quite well
supported by empirical data.
Fanchart for variable Inflation
0 5 10 15 20 25 30 35
−0.040.02
Fanchart for variable BondYield10Y
0 5 10 15 20 25 30 35
−0.050.10
Pulling all together
This algorithm simulatrs the distribution of annuity’s:
1. simulate Kt .
2. Project the fixed cash flow vector 1
k
for all t in 0, 1
k
, 2
k
, . . . , Kt .
3. Simulate a rt path.
4. Simulate a it path by the relation it = α + β ∗ rt + γt .
5. Determine real interest rate vector and discount.
The figure below shows the distribution of the Kt and
¨aK+1
=
Kx
j=0
vj
∗ cj after allowing for process and parameter variance
(for the demographic component).
0.00
0.02
0.04
0 10 20 30
Kt
density
Residual Curtate Life Time Distribution
0.00
0.02
0.04
0.06
0 10 20 30 40
Present Value
density
Annuity Present Value Simulated Distribution
Full Stochastic simulation
Expected value changes moderately and standard deviations increases
slightly for Kx and ¨aKx +1
=
Kx
j=0
vj
∗ cj distributions.
#central scenario remark
c(ex65.base,ax65.base)
## ex65 ax65
## 18.72669 14.95836
#assessing impact on expected value
apply(final.simulation,2,mean)/apply(processVarianceSimulations,2,mean)
## residualLifetime annuityAPV
## 0.9836045 1.0722882
#assessing impact on volatility
apply(final.simulation,2,sd)/apply(processVarianceSimulations,2,sd)
## residualLifetime annuityAPV
## 1.173815 1.125270
Other package’s features
Even if not discussed in the presentation, it is worth to remark that
lifecontingencies package allows to calculate also the impact of reversionary
annuity benefits (see below the calculation for axy . Multiple decrements will
be fully supported within 2015.
#baseline benefit
ax65.base
## ax65
## 14.95836
#allowign for reversionary on 62
axn(actuarialtable = at1950Baseline,x = 65,k=12)+
(axn(actuarialtable = at1950Baseline,x = 62,k=12)-
axyzn(tablesList = list(at1950Baseline,at1950Baseline),
x = c(65,62),status = "joint",k = 12))
## [1] 18.85357
Bibliography I
Eddelbuettel, Dirk. 2013. Seamless R and C++ Integration with Rcpp. New
York: Springer.
Giorgio Alfredo Spedicato. 2015. Markovchain: Discrete Time Markov Chains
Made Easy.
Hyndman, Rob J, and Yeasmin Khandakar. 2008. “Automatic Time Series
Forecasting: The Forecast Package for R.” Journal of Statistical Software 26 (3):
1–22. http://ideas.repec.org/a/jss/jstsof/27i03.html.
Lee, Ronald D, and Lawrence R Carter. 1992. “Modeling and Forecasting US
Mortality.” Journal of the American Statistical Association 87 (419). Taylor &
Francis Group: 659–71.
Pfaff, Bernhard. 2008. “VAR, SVAR and SVEC Models: Implementation Within
R Package vars.” Journal of Statistical Software 27 (4).
http://www.jstatsoft.org/v27/i04/.
Rob J Hyndman, Heather Booth, Leonie Tickle, and John Maindonald. 2011.
Demography: Forecasting Mortality, Fertility, Migration and Population Data.
http://CRAN.R-project.org/package=demography.
Ryan, Jeffrey A. 2015. Quantmod: Quantitative Financial Modelling Framework.
http://CRAN.R-project.org/package=quantmod.
Bibliography II
Ryan, Jeffrey A., and Joshua M. Ulrich. 2014. Xts: EXtensible Time Series.
http://CRAN.R-project.org/package=xts.
Spedicato, Giorgio Alfredo. 2013. “The lifecontingencies Package: Performing
Financial and Actuarial Mathematics Calculations in R.” Journal of Statistical
Software 55 (10): 1–36. http://www.jstatsoft.org/v55/i10/.
University of California, and Max Planck Institute for Demographic Research.
2015. “Human Mortality DataBase.” Available at www.mortality.org or
www.humanmortality.de (data downloaded on 14th June 2015).

More Related Content

Viewers also liked (8)

Using Grammatical Evolution to develop trading rules
Using Grammatical Evolution to develop trading rulesUsing Grammatical Evolution to develop trading rules
Using Grammatical Evolution to develop trading rules
 
20130325 mldm monday spide r
20130325 mldm monday spide r20130325 mldm monday spide r
20130325 mldm monday spide r
 
20130506 mldm monday intorduction to quantmod package
20130506 mldm monday intorduction to  quantmod package20130506 mldm monday intorduction to  quantmod package
20130506 mldm monday intorduction to quantmod package
 
20161110 quantstrat in seattle
20161110 quantstrat in seattle20161110 quantstrat in seattle
20161110 quantstrat in seattle
 
ETL in R
ETL in RETL in R
ETL in R
 
Seminar PSU 10.10.2014 mme
Seminar PSU 10.10.2014 mmeSeminar PSU 10.10.2014 mme
Seminar PSU 10.10.2014 mme
 
R in finance: Introduction to R and Its Applications in Finance
R in finance: Introduction to R and Its Applications in FinanceR in finance: Introduction to R and Its Applications in Finance
R in finance: Introduction to R and Its Applications in Finance
 
Hidden Markov Model & Stock Prediction
Hidden Markov Model & Stock PredictionHidden Markov Model & Stock Prediction
Hidden Markov Model & Stock Prediction
 

Similar to Spedicato r ininsurance2015

Time series mnr
Time series mnrTime series mnr
Time series mnr
NH Rao
 
Andrew_Hair_Assignment_3
Andrew_Hair_Assignment_3Andrew_Hair_Assignment_3
Andrew_Hair_Assignment_3
Andrew Hair
 

Similar to Spedicato r ininsurance2015 (20)

Customer Lifetime Value Modeling
Customer Lifetime Value ModelingCustomer Lifetime Value Modeling
Customer Lifetime Value Modeling
 
Regression and Classification with R
Regression and Classification with RRegression and Classification with R
Regression and Classification with R
 
From real to risk neutral probability measure for pricing and managing cva
From real to risk neutral probability measure for pricing and managing cvaFrom real to risk neutral probability measure for pricing and managing cva
From real to risk neutral probability measure for pricing and managing cva
 
Time series mnr
Time series mnrTime series mnr
Time series mnr
 
Scenario generation and stochastic programming models for asset liabiltiy man...
Scenario generation and stochastic programming models for asset liabiltiy man...Scenario generation and stochastic programming models for asset liabiltiy man...
Scenario generation and stochastic programming models for asset liabiltiy man...
 
Efficient Numerical PDE Methods to Solve Calibration and Pricing Problems in ...
Efficient Numerical PDE Methods to Solve Calibration and Pricing Problems in ...Efficient Numerical PDE Methods to Solve Calibration and Pricing Problems in ...
Efficient Numerical PDE Methods to Solve Calibration and Pricing Problems in ...
 
2019 GDRR: Blockchain Data Analytics - Modeling Cryptocurrency Markets with T...
2019 GDRR: Blockchain Data Analytics - Modeling Cryptocurrency Markets with T...2019 GDRR: Blockchain Data Analytics - Modeling Cryptocurrency Markets with T...
2019 GDRR: Blockchain Data Analytics - Modeling Cryptocurrency Markets with T...
 
CVA In Presence Of Wrong Way Risk and Early Exercise - Chiara Annicchiarico, ...
CVA In Presence Of Wrong Way Risk and Early Exercise - Chiara Annicchiarico, ...CVA In Presence Of Wrong Way Risk and Early Exercise - Chiara Annicchiarico, ...
CVA In Presence Of Wrong Way Risk and Early Exercise - Chiara Annicchiarico, ...
 
IRJET - Candle Stick Chart for Stock Market Prediction
IRJET - Candle Stick Chart for Stock Market PredictionIRJET - Candle Stick Chart for Stock Market Prediction
IRJET - Candle Stick Chart for Stock Market Prediction
 
The Short-term Swap Rate Models in China
The Short-term Swap Rate Models in ChinaThe Short-term Swap Rate Models in China
The Short-term Swap Rate Models in China
 
Intro to econometrics
Intro to econometricsIntro to econometrics
Intro to econometrics
 
Affine cascade models for term structure dynamics of sovereign yield curves
Affine cascade models for term structure dynamics of sovereign yield curvesAffine cascade models for term structure dynamics of sovereign yield curves
Affine cascade models for term structure dynamics of sovereign yield curves
 
Solution manual for essentials of business analytics 1st editor
Solution manual for essentials of business analytics 1st editorSolution manual for essentials of business analytics 1st editor
Solution manual for essentials of business analytics 1st editor
 
Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)
Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)
Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)
 
Achieving Consistent Modeling Of VIX and Equities Derivatives
Achieving Consistent Modeling Of VIX and Equities DerivativesAchieving Consistent Modeling Of VIX and Equities Derivatives
Achieving Consistent Modeling Of VIX and Equities Derivatives
 
Calibrating the Lee-Carter and the Poisson Lee-Carter models via Neural Netw...
Calibrating the Lee-Carter and the Poisson Lee-Carter models  via Neural Netw...Calibrating the Lee-Carter and the Poisson Lee-Carter models  via Neural Netw...
Calibrating the Lee-Carter and the Poisson Lee-Carter models via Neural Netw...
 
Andrew_Hair_Assignment_3
Andrew_Hair_Assignment_3Andrew_Hair_Assignment_3
Andrew_Hair_Assignment_3
 
Monte carlo-simulation
Monte carlo-simulationMonte carlo-simulation
Monte carlo-simulation
 
Exam binder 1
Exam binder 1Exam binder 1
Exam binder 1
 
DCT
DCTDCT
DCT
 

More from Giorgio Alfredo Spedicato

More from Giorgio Alfredo Spedicato (15)

Machine Learning - Supervised Learning
Machine Learning - Supervised LearningMachine Learning - Supervised Learning
Machine Learning - Supervised Learning
 
Machine Learning - Unsupervised Learning
Machine Learning - Unsupervised LearningMachine Learning - Unsupervised Learning
Machine Learning - Unsupervised Learning
 
Machine Learning - Principles
Machine Learning - PrinciplesMachine Learning - Principles
Machine Learning - Principles
 
Machine Learning - Intro
Machine Learning - IntroMachine Learning - Intro
Machine Learning - Intro
 
Meta analysis essentials
Meta analysis essentialsMeta analysis essentials
Meta analysis essentials
 
The markovchain package use r2016
The markovchain package use r2016The markovchain package use r2016
The markovchain package use r2016
 
Cat Bond and Traditional Insurance
Cat Bond and Traditional InsuranceCat Bond and Traditional Insurance
Cat Bond and Traditional Insurance
 
It skills for actuaries
It skills for actuariesIt skills for actuaries
It skills for actuaries
 
Statistics in insurance business
Statistics in insurance businessStatistics in insurance business
Statistics in insurance business
 
R in Insurance 2014
R in Insurance 2014R in Insurance 2014
R in Insurance 2014
 
L'assicurazione rca gs
L'assicurazione rca   gsL'assicurazione rca   gs
L'assicurazione rca gs
 
P & C Reserving Using GAMLSS
P & C Reserving Using GAMLSSP & C Reserving Using GAMLSS
P & C Reserving Using GAMLSS
 
Princing insurance contracts with R
Princing insurance contracts with RPrincing insurance contracts with R
Princing insurance contracts with R
 
Pricing and modelling under the Italian Direct Compensation Card Scheme
Pricing and modelling under the Italian Direct Compensation Card SchemePricing and modelling under the Italian Direct Compensation Card Scheme
Pricing and modelling under the Italian Direct Compensation Card Scheme
 
Actuarial modeling of general practictioners' drug prescriptions costs
Actuarial modeling of general practictioners' drug prescriptions costsActuarial modeling of general practictioners' drug prescriptions costs
Actuarial modeling of general practictioners' drug prescriptions costs
 

Spedicato r ininsurance2015

  • 1. Annuities Modeling with R Giorgio Alfredo Spedicato, Ph.D C.Stat ACAS 29th June 2015
  • 2.
  • 3. Intro The use of lifecontingencies R package (Spedicato 2013) to evaluate annuities will be introduced. lifecontingencies package provides a broad set of tools to perform actuarial calculations on life insurances. It requires a recent version of R (>=3.0), the markovchain package (Giorgio Alfredo Spedicato 2015) and Rcpp (Eddelbuettel 2013). This presentation is focused on actuarial evaluation of annuities present value distribution from the perspective of a Pension Fund.
  • 4. As a memo, the present value of a life annuity on a policyholder aged x is a random variable that depends on the future lifetime, Kx , future cash flows cj and future (real) discount factors vj = 1+rj 1+ij − 1. It can be written as ¨aKx +1 = Kx j=0 vj ∗ cj . Therefore it is a function of three random variables: the residual life time, Kt , the nominal (future) rates of interest, rt , and the (future) inflation rates it , where t ∈ 0, 1 k , . . . , Kt , .
  • 5. We will calculate APV from a classical central baseline scenario (defined life table and fixed financials hyphotheses). We will then allow for variability on these hyphoteses. In particular we will allow for process and parameter variance on the demographical side of calculation. Stochastic interest rate and inflation scenarios will be simulated as well. Slides will contain key code snippets, figures and tables. The dedicated repository (https://bitbucket.org/spedygiorgio/rininsurance2015) collect the full code needed to replicate the results.
  • 6. Collecting data Collecting Financial from FRED We will retrieve economics from Federal Reserve Economic Data using quantmod package (Ryan 2015). Demographic tables used to project life tables will come from Human Mortality Database (University of California and Demographic Research 2015). #retrieving Italian financial data from FRED library(quantmod) getSymbols(Symbols = 'ITACPIALLMINMEI',src='FRED') #CPI getSymbols(Symbols='IRLTLT01ITM156N', src='FRED') #Nominal IR (10Y Bond Yield)
  • 7. we can observe a certain degree of structural dependency between i and r, that suggests the use of cointegration analysis for modeling. 0% 5% 10% 15% 0% 5% 10% 15% BondYield10YInflation 1990 1995 2000 2005 2010 2015 month rate Italian Inflation and Nominal Interest Rates since 1991
  • 8. Collecting demographics from HMD Retrieving data from Human Mortality Database (HMD) is easy as well library(demography) italyDemo<-hmd.mx("ITA", username="yourUN", password="yourPW")
  • 9. 0 20 40 60 80 100 −10−8−6−4−202 Italy: total death rates (1872−2009) Age Logdeathrate
  • 10. Defining baseline actuarial hyphotheses Our baseline hyphoteses are: retiree age: x = 65, cohort 1950. yearly pension benefit: 1, CPI indexed. frequency of payment of 1 k payments k = 12. mortality model: Lee Carter. no survivors benefit: no reversionary annuity component. only one interest rate (r): 10 year governemnt bond yield. Baseline inflation (i) and nominal interest rate (r) calculated as straight average of 10 Years values between 1999 and 2014 (Euro Currency Era). This yields a real discount factor around 2.4%.
  • 11. xts package (Ryan and Ulrich 2014) functions have been used to calculate baseline figures. #use xts functions to calculate yearly averages finHyph<-apply(apply.yearly(x = italy.fin["1999/2014",2:1], FUN="mean"),2,"mean") infl<-finHyph[1];nomRate<-finHyph[2] realRate<-(1+nomRate)/(1+infl)-1 names(realRate)<-"RealRate" c(nomRate, infl, realRate) ## BondYield10Y Inflation RealRate ## 0.04520074 0.02073512 0.02396862
  • 12. Projecting mortality Mortality dynamics will follow Lee Carter model (Lee and Carter 1992): qx,t = eax +bx ∗kt +εx,t , We will start projecting a central scenario for mortality on which a baseline life table can be derived for the 1950 cohort. demography (Rob J Hyndman et al. 2011) and forecast (Hyndman and Khandakar 2008) packages calibrate and perform Lee Carter’ model projections respectively.
  • 13. historical and projected KT year kt 1900 1950 2000 2050 2100 −300−200−1000100
  • 14. -The code below generates the matrix of prospective life tables #getting and defining the life tables matrix mortalityTable<-exp(italy.leecarter$ax+ italy.leecarter$bx%*%t(kt.full)) rownames(mortalityTable)<-seq(from=0, to=103) colnames(mortalityTable)<-seq(from=1872, to=1872+dim(mortalityTable)[2]-1)
  • 15. The function below returns the yearly death probabilities for a given birth cohort. getCohortQx<-function(yearOfBirth) { colIndex<-which(colnames(mortalityTable) ==yearOfBirth) #identify #the column corresponding to the cohort #definex the probabilities from which #the projection is to be taken maxLength<-min(nrow(mortalityTable)-1, ncol(mortalityTable)-colIndex) qxOut<-numeric(maxLength+1) for(i in 0:maxLength) qxOut[i+1]<-mortalityTable[i+1,colIndex+i] #fix: we add a fictional omega age where #death probability = 1 qxOut<-c(qxOut,1) return(qxOut) }
  • 16. Now we can get a baseline projected life table for a 1950 born. #generate the life tables qx1950<-getCohortQx(yearOfBirth = 1950) lt1950<-probs2lifetable(probs=qx1950,type="qx", name="Baseline") at1950Baseline<-new("actuarialtable",x=lt1950@x, lx=lt1950@lx,interest=realRate)
  • 17. 0 20 40 60 80 100 0200040006000800010000 life table Generic life table x values populationatrisk
  • 18. Variability assessment Process variance It is now easy to assess the expected curtate lifetime, ˚e65 and the APV of the annuity ¨a12 65, for x = 65. #curtate lifetime @x=65 ex65.base<-exn(object = at1950Baseline,x = 65) names(ex65.base)<-"ex65" #APV of an annuity, allowing for fractional payment ax65.base<-axn(actuarialtable = at1950Baseline, x=65,k = 12);names(ax65.base)<-"ax65" c(ex65.base,ax65.base) ## ex65 ax65 ## 18.72669 14.95836
  • 19. It is possible to simulate the process variance (due to “pure” chance on residual life time) of both Kt and ¨aKx +1 = Kx j=0 vj ∗ cj . #simulate curtate lifetime lifesim<-rLife(n=1e4,object=at1950Baseline,x=65,k=12,type = "Kx") c(mean(lifesim),sd(lifesim)) ## [1] 19.057092 8.263257 #simulate annuity present value annuitysim<-rLifeContingencies(n=1e4,lifecontingency="axn", object=at1950Baseline,x=65,k=12,parallel=TRUE) c(mean(annuitysim),sd(annuitysim)) ## [1] 14.943719 5.548229
  • 20. 0.00 0.01 0.02 0.03 0.04 0.05 0 10 20 30 40 Kt density Remaining lifetime 0.00 0.02 0.04 0.06 0.08 0 10 20 APV density Annuity Actuarial Present Value simulation Process Variance simulation
  • 21. Stochastic life tables Estimation variance due to the demographic component arises from uncertainty in demographic assumption (stochastic life tables). We take into account this source of variability generating random life tables by randomizing kt projections and by sampling from εx,t on the Lee Carter above mentioned formula.
  • 22. The code that follows integrates the simulation of parameter and process variance on the demographic component. ###nesting process variance and parameter variance numsim.parvar=31 numsim.procvar=31 ### simulating parameter variance tablesList<-list() for(i in 1:numsim.parvar) tablesList[[i]] <- tableSimulator(lcObj = italy.leecarter, kt.model = italy.kt.model, coort = 1950, type = 'simulated', ltName = paste("table",i), rate=realRate ) ### simulating process variance lifesim.full<-as.numeric(sapply(X=tablesList, FUN="rLife",n=numsim.procv annuitysim.full<-as.numeric(sapply(X=tablesList, FUN="rLifeContingencies
  • 23. Varying financial assumptions Changing nominal interest rate assumption We assume only one financial asset: 10 years Gvt Bond. Interest rate dynamic follows a Vasicek model, drt = λ ∗ (rt − µ) ∗ dt + σ ∗ dWt . Therefore parameters can be estimated by least squares from the equation St = a ∗ St−1 + b + εt , as shown below. We have used the approach shown in http://www.sitmo.com/article/ calibrating-the-ornstein-uhlenbeck-model/. λ = − lna δ µ = b 1 − a σ = sd(ε) − 2 ∗ ln (a) δ ∗ (1 − a2)
  • 24. The function that follows calibrates the Vasicek interest rate mode on Italian data since 1991. calibrateVasicek<-function(x, delta=1) { y<-as.zoo(x) x<-lag(y,-1,na.pad=TRUE) myDf<-data.frame(y=y,x=x) linMod <- lm(y~x,data=myDf) a<-coef(linMod)[2] b<-coef(linMod)[1] lambda<- as.numeric(-log(a)/delta) mu <- as.numeric(b/(1-a)) sigma <- as.numeric(((-2*log(a))/(delta*(1-a^2)))^.5*sd(linMod$residu out<-list(lamdba=lambda, mu=mu, sigma=sigma) return(out) }
  • 25. The calibrated parameters follows. However the long term average has been judgmentally fixed to 4.52%. They will be used to simulate Vasicek - driven interest rates paths. #calibrate italianRatesVasicek<-calibrateVasicek(x =as.numeric(italy.fin[,1]), delta=1/12) italianRatesVasicek ## $lamdba ## [1] 0.1129055 ## ## $mu ## [1] 0.01704393 ## ## $sigma ## [1] 0.0102649 #simulate randomInterestRateWalk<-ts(VasicekSimulations(M = 1,N = 40*12,r0 = 0.04, italianRatesVasicek$sigma ,dt = 1/12)[,1],start=c(2015,4),frequency=12)
  • 26. One Vasicek interest rate walk month nominalinterestrate 2020 2030 2040 2050 0.000.020.040.060.080.10
  • 27. Modeling inflation dynamic The dependency between nominal rates and inflation is well know. Cointegration analysis is needed to avoid spurious regression. We have assumed the their relationship to be linear inft = α + β ∗ rt + γt . Cointegration analysis on annualized data was peformed using package vars (Pfaff 2008). One cointegrating relationship was found to be quite well supported by empirical data.
  • 28. Fanchart for variable Inflation 0 5 10 15 20 25 30 35 −0.040.02 Fanchart for variable BondYield10Y 0 5 10 15 20 25 30 35 −0.050.10
  • 29. Pulling all together This algorithm simulatrs the distribution of annuity’s: 1. simulate Kt . 2. Project the fixed cash flow vector 1 k for all t in 0, 1 k , 2 k , . . . , Kt . 3. Simulate a rt path. 4. Simulate a it path by the relation it = α + β ∗ rt + γt . 5. Determine real interest rate vector and discount.
  • 30. The figure below shows the distribution of the Kt and ¨aK+1 = Kx j=0 vj ∗ cj after allowing for process and parameter variance (for the demographic component). 0.00 0.02 0.04 0 10 20 30 Kt density Residual Curtate Life Time Distribution 0.00 0.02 0.04 0.06 0 10 20 30 40 Present Value density Annuity Present Value Simulated Distribution Full Stochastic simulation
  • 31. Expected value changes moderately and standard deviations increases slightly for Kx and ¨aKx +1 = Kx j=0 vj ∗ cj distributions. #central scenario remark c(ex65.base,ax65.base) ## ex65 ax65 ## 18.72669 14.95836 #assessing impact on expected value apply(final.simulation,2,mean)/apply(processVarianceSimulations,2,mean) ## residualLifetime annuityAPV ## 0.9836045 1.0722882 #assessing impact on volatility apply(final.simulation,2,sd)/apply(processVarianceSimulations,2,sd) ## residualLifetime annuityAPV ## 1.173815 1.125270
  • 32. Other package’s features Even if not discussed in the presentation, it is worth to remark that lifecontingencies package allows to calculate also the impact of reversionary annuity benefits (see below the calculation for axy . Multiple decrements will be fully supported within 2015. #baseline benefit ax65.base ## ax65 ## 14.95836 #allowign for reversionary on 62 axn(actuarialtable = at1950Baseline,x = 65,k=12)+ (axn(actuarialtable = at1950Baseline,x = 62,k=12)- axyzn(tablesList = list(at1950Baseline,at1950Baseline), x = c(65,62),status = "joint",k = 12)) ## [1] 18.85357
  • 33. Bibliography I Eddelbuettel, Dirk. 2013. Seamless R and C++ Integration with Rcpp. New York: Springer. Giorgio Alfredo Spedicato. 2015. Markovchain: Discrete Time Markov Chains Made Easy. Hyndman, Rob J, and Yeasmin Khandakar. 2008. “Automatic Time Series Forecasting: The Forecast Package for R.” Journal of Statistical Software 26 (3): 1–22. http://ideas.repec.org/a/jss/jstsof/27i03.html. Lee, Ronald D, and Lawrence R Carter. 1992. “Modeling and Forecasting US Mortality.” Journal of the American Statistical Association 87 (419). Taylor & Francis Group: 659–71. Pfaff, Bernhard. 2008. “VAR, SVAR and SVEC Models: Implementation Within R Package vars.” Journal of Statistical Software 27 (4). http://www.jstatsoft.org/v27/i04/. Rob J Hyndman, Heather Booth, Leonie Tickle, and John Maindonald. 2011. Demography: Forecasting Mortality, Fertility, Migration and Population Data. http://CRAN.R-project.org/package=demography. Ryan, Jeffrey A. 2015. Quantmod: Quantitative Financial Modelling Framework. http://CRAN.R-project.org/package=quantmod.
  • 34. Bibliography II Ryan, Jeffrey A., and Joshua M. Ulrich. 2014. Xts: EXtensible Time Series. http://CRAN.R-project.org/package=xts. Spedicato, Giorgio Alfredo. 2013. “The lifecontingencies Package: Performing Financial and Actuarial Mathematics Calculations in R.” Journal of Statistical Software 55 (10): 1–36. http://www.jstatsoft.org/v55/i10/. University of California, and Max Planck Institute for Demographic Research. 2015. “Human Mortality DataBase.” Available at www.mortality.org or www.humanmortality.de (data downloaded on 14th June 2015).