SlideShare une entreprise Scribd logo
1  sur  53
Télécharger pour lire hors ligne
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Economic Scenarios Generation for 
Insurance: ESGtoolkit (and friends) 
Institut de Sciences Financières et d’Assurances, 
Université Lyon 1 
Thierry Moudiki (@moudikithierry) 
September 26, 2014
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry)
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Contents 
1. Context 
2. ESGtoolkit 
I About model risk 
I About discretization error 
I About calibration error
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Why ? 
I As an insurer, basically : 
I How much should I keep aside today at t = 0, for the 
payment of a guaranteed compensation tomorrow at 
t = T: 
Liabs0 = BestEstimateLiabs0 + Margin0 
=) Reserving : pricing the guaranteed compensation 
I Having calculated Liabs0, I’d like to derive x  0, so 
that : 
P(AssetsT − LiabsT  x)  1 − % 
=) Capital modeling : determining the future 
distribution of my Own Funds
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Why ? (cont’d) 
Regulatory point of view 
I Market Consistent Embedded value (MCEV) : 
Time Value of Financial Options  Guarantees (TVOFG) 
I **Solvency II : 
I ** Best Estimate valuation of the technical reserves 
(BEL) 
I Solvency II : Own Risk Solvency Assessment (ORSA) 
But : 
I For pricing (reserving) : not always closed formulas 
available for pricing the guarantees (risk asymmetry 
induced by the optional features) 
I For capital modeling : not always (never !) 
entirely-specified probability distributions available for 
the Own Funds
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Context 
What ? 
From what’s been said : Modeling and simulation of risk 
factors are needed. 
ESG : Economic Scenarios Generator 
I Tool for modeling and simulation of economic factors’ 
future values 
I Purpose : Asset  Liability Management in Banking 
and Insurance. 
I Our focus : Insurance
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
How ? 
How can we do that ? 
I With Monte Carlo simulation 
I But also, Bootstrapping can be used 
Generally, 2 types of simulations 
I Real-world simulations under the objective probability : 
for capital modeling 
I Risk-neutral simulations under a martingale probability 
measure : for reserving/pricing
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
The package ESGtoolkit Thierry Moudiki 
(@moudikithierry) 
I An R package providing tools, for constructing custom 
Economic Scenario Generators (ESG) 
I Version 0.1 released in june 2014 
I A vignette is available (now in PDF, in HTML soon) 
I Under development 
I Suggestions, bug reports, and features request are 
welcome.
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Why R ? 
I The language of Analytics; 2 million users worldwide 
(Source : Seven quick facts about R) 
I Free + Open source 
I Over 5800 contributed packages on CRAN repository, 
doing almost anything you could think of (Visit : the 
Task Views) 
I “Researchers in statistics and machine learning will 
often publish an R package to accompany their 
articles. This means immediate access to the very 
latest statistical techniques and implementations.” 
Hadley Wickham (RStudio)
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Contents 
1. Context 
2. ESGtoolkit 
I About model risk 
I About discretization error 
I About calibration error
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
ESGtoolkit 
I Currently, 3 main functions 
I simdiff (underlying C++ code via Rcpp) : 
I Ornstein-Uhlenbeck process simulation 
I Cox-Ingersoll-Ross process simulation 
I Geometric Brownian motion with constant or 
time-dependent drift or volatility, and optional 
(lognormal or double-exponential) jumps 
I simshocks : 
I simulation of gaussian shocks with highly flexible 
dependence structure 
I esgfwdrates : 
I instantaneous forward rates for no-arbitrage short rate 
models 
I And additional functions for diagnostics : 
esgplotbands, esgplotshocks, 
esgplotmartingaletest, . . .
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
ESGtoolkit 
ESGtoolkit current structure 
simshocks 
(Gaussian, Student t, Clayton ...) 
simdiff 
(OU, CIR, GBM−likes) 
esgfwdrates 
(Nelson−Siegel, Smith−Wilson ...) 
various models 
(Vasicek, BS, Merton, Heston, Bates...) 
no−arbitrage short rates models 
(HW, G2++, CIR++, BK, ...)
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
However, remember 
I “Essentially, all models are wrong, but some are useful” 
George E. P. Box 
I . . . also, some can lead to disasters.
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
From Felix Salmon’s Recipe for Disaster: The Formula That 
Killed Wall Street (available online)
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) However, remember 
3 types of risks in the process of modeling and simulation of 
risk factors : 
I Model risk 
I Choice of the model 
I Choice of the dependence structure 
I Discretization error 
I Calibration error
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Contents 
1. Context 
2. ESGtoolkit 
I About model risk 
I About discretization error 
I About calibration error
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
About model risk 
Choice of the model and choice of the dependence 
structure 
A simple example : Insurance company, ABC corp., that 
has, on December 30, 2011, 2 assets in its portfolio : 
A0 = Nominal × (40%CAC 40 + 60%SP 500) 
The liabilities on December 30, 2011 are : 
L0 = 45% × A0 
ABC corp. has to pay daily guaranteed benefits K to the 
insured, plus an additional benefits depending on the daily 
performance of the assets : 
8i  0, Li = Li−1 − K × 
 
1 + 95%max 
 Ai 
Ai−1 
 
− 1, 0
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Analyst wants to assess ABC corp.’s 6-month solvency 
and uses R 
# loading the package quantmod 
# to obtain financial index time series 
library(quantmod) 
# Importing the values of the CAC40 and SP500 
# CAC40, as a time series (ts) object 
getSymbols('^FCHI', src='yahoo', 
return.class = 'ts', 
from = 2011-06-30, 
to = 2011-12-30) 
# SP500, as a time series (ts) object 
getSymbols('^GSPC', src='yahoo', 
return.class = 'ts', 
from = 2011-06-27, 
to = 2011-12-30)
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
The type of data we can get from quantmod 
head(FCHI)[, 1:4] 
## FCHI.Open FCHI.High FCHI.Low FCHI.Close 
## [1,] 3937 3982 3926 3982 
## [2,] 3982 4024 3967 4007 
## [3,] 4010 4010 3997 4003 
## [4,] 3997 3999 3974 3979 
## [5,] 3981 3982 3942 3961 
## [6,] 3982 4020 3960 3980
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
I Using the closing prices S (CAC) 
Thierry Moudiki 
(@moudikithierry) t , S(SP) 
t analyst calculates 
the daily log-returns 
log 
0 
@S(CAC) 
ti+1 
S(CAC) 
ti 
1 
A 
and 
log 
0 
@S(SP) 
ti+1 
S(SP) 
ti 
1 
A
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Normality of the log-returns ? 
Histogram of log.ret.CAC 
log.ret.CAC 
Frequency 
−0.06 −0.04 −0.02 0.00 0.02 0.04 0.06 
0 5 10 15 20 25 
−2 −1 0 1 2 
−0.06 −0.02 0.02 0.06 
Normal Q−Q Plot 
Theoretical Quantiles 
Sample Quantiles 
Histogram of log.ret.SP 
log.ret.SP 
Frequency 
−0.06 −0.04 −0.02 0.00 0.02 0.04 
0 5 10 15 20 25 30 
−2 −1 0 1 2 
−0.06 −0.02 0.02 
Normal Q−Q Plot 
Theoretical Quantiles 
Sample Quantiles
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Normality of the log-returns ? (cont’d) 
shapiro.test(log.ret.CAC) 
## 
## Shapiro-Wilk normality test 
## 
## data: log.ret.CAC 
## W = 0.9906, p-value = 0.5268 
shapiro.test(log.ret.SP) 
## 
## Shapiro-Wilk normality test 
## 
## data: log.ret.SP 
## W = 0.9827, p-value = 0.0962
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Maximum likelihood estimation 
I Analyst assumes that : 
I the distribution of the assets over the next 6 
months will be the same that she observed in the 
last 6-months period. 
Maximum likelihood is used to calibrate the lognormal 
models : 
# Parameters for the projection of the CAC 40 
delta - 1/252 # for daily sampling 
sigma.CAC - sqrt((n-1)/n)*sd(log.ret.CAC)/sqrt(delta) 
mu.CAC - mean(log.ret.CAC)/delta + 
0.5*sigma.CAC^2
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Correlation ? 
I Based on : 
I the histograms 
I the Normal qqplot 
I the results of the tests (Normality not rejected) 
ABC corp.’s analyst assumes that the distribution of the 
assets on the period of interest is lognormal. 
I But she now wants to know more about the 
dependence between the assets
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Correlation ? (cont’d) 
I Visualizing the indices on the 6-month period, and the 
log-returns 
CAC 40 
Time 
S.CAC 
0 20 40 60 80 100 120 
2800 3400 4000 
SP 500 
Time 
S.SP 
0 20 40 60 80 100 120 
1100 1200 1300 
0 20 40 60 80 100 120 
−0.06 0.00 0.04 
log−returns 
Index 
log.ret.CAC
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Correlation ? (cont’d) 
I She decides to 
I assume that the assets are correlated (Gaussian 
dependence). 
The correlation coefficients between the shocks is : 
U.S.CAC - pnorm((log.ret.CAC - mean(log.ret.CAC)) 
/sd(log.ret.CAC)) 
U.S.SP - pnorm((log.ret.SP - mean(log.ret.SP))/ 
sd(log.ret.SP)) 
(correlation - cor(U.S.CAC, U.S.SP)) 
## [1] 0.3852
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Correlation ? (cont’d) 
However. . . 
# Package CDVine : Statistical inference of 
# canonical vine (C-vine) and D-vine copulas 
library(CDVine) 
copula.selection - BiCopSelect(U.S.CAC, U.S.SP) 
print(c(copula.selection$family, copula.selection$par, 
Thierry Moudiki 
(@moudikithierry) 
copula.selection$par2)) 
## [1] 2.0000 0.4227 9.1056 
I R package CDVine (see jstatsoft paper) says : 
I Student t dependence, with 9.11 degrees of freedom, 
and dependence parameter equal to 0.42
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
I Simulation of shocks with ESGtoolkit 
library(ESGtoolkit) 
# Nb of simulations, horizon, and frequency 
nb - 10000 
horizon - 1 
freq - daily 
# Simulation of shocks 
set.seed(1) 
# With student dependence 
eps.student - simshocks(n = nb, 
horizon = horizon, frequency = freq, 
family = copula.selection$family, 
par = copula.selection$par, 
par2 = copula.selection$par2)
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
I Simulation of future values of assets with simdiff 
Simulation with Gaussian dependence is exactly the same, but 
uses eps.gaussian for the shocks 
# With Student dependence 
# CAC 40 
sim.CAC.t - window(simdiff(n = nb, 
horizon = horizon, model = GBM, 
frequency = freq, x0 = S.CAC[n], 
theta1 = mu.CAC, theta2 = sigma.CAC, 
eps = eps.student[[1]]), end = 0.5) 
# SP 500 
sim.SP.t - window(simdiff(n = nb, 
horizon = horizon, 
model = GBM, 
frequency = freq, x0 = S.SP[n], 
theta1 = mu.SP, theta2 = sigma.SP, 
eps = eps.student[[2]]), end = 0.5)
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
I Visualizing the projections of assets’ values with 
esgplotbands 
par(mfrow = c(2, 2)) 
esgplotbands(sim.CAC.t, xlab = time, 
ylab = index values) 
lines(S.CAC.future, col = red) 
esgplotbands(sim.SP.t, xlab = time, 
ylab = index values) 
lines(S.SP.future, col = blue) 
esgplotbands(sim.CAC.g, xlab = time, 
ylab = index values) 
lines(S.CAC.future, col = red) 
esgplotbands(sim.SP.g, xlab = time, 
ylab = index values) 
lines(S.SP.future, col = blue)
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
I Visualizing the projections of assets’ values with 
esgplotbands. The true values (from January to June 
2012) are the red lines and the blue lines. 
0.0 0.1 0.2 0.3 0.4 0.5 
1000 2000 3000 4000 5000 6000 7000 8000 
CAC 40 projection 
(Student dependence) 
time 
index values 
0.0 0.1 0.2 0.3 0.4 0.5 
500 1000 1500 2000 2500 
SP 500 projection 
(Student dependence) 
time 
index values 
0.0 0.1 0.2 0.3 0.4 0.5 
1000 2000 3000 4000 5000 6000 7000 
CAC 40 projection 
(gaussian dependence) 
time 
index values 
0.0 0.1 0.2 0.3 0.4 0.5 
500 1000 1500 2000 2500 3000 
SP 500 projection 
(gaussian dependence) 
time 
index values
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
I Assets and Liabilities simulation for the Net Asset Value 
(the whole code is available) 
### The insurer's Asset 
w1 - 0.4 
w2 - 1-w1 
Nominal - 100000 
# With gaussian dependence 
S.g - Nominal*(w1*sim.CAC.g + w2*sim.SP.g) 
# With Student t dependence 
S.t - Nominal*(w1*sim.CAC.t + w2*sim.SP.t) 
### The insurer's liability 
# With gaussian and Student t dependence (at t=0) 
L0.g - L0.t - S.g[1,1]*0.45 
# Guaranteed capital 
K - 80 
# Pct. for additional benefits 
pct.PB - .95
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
I Assets and Liabilities simulation for the Net Asset Value 
# variation of liabilities 
fact.growth.t - -K*(1 + pct.PB*(S.t.mat[-1, ]/ 
S.t.mat[-nrowS, ] - 1)* 
(S.t.mat[-1, ]/S.t.mat[-nrowS, ] - 1  0)) 
# Liabilities simulation (Student) 
L.t - ts(apply(rbind(rep(L0.t, ncolS), fact.growth.t), 2, 
cumsum), 
start = start(S.t), deltat = deltat(S.t)) 
# Net Asset Value 
NAV.t - S.t - L.t
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
I Estimating the 6-month required capital with Gaussian 
and Student dependences (the whole code is available) 
# VaR Gaussian vs Student dep. 
qt.NAV.t - quantile(NAV.t.last, 
probs = 1 - c(0.9, 0.95, 0.995)) 
(qt.NAV.t/qt.NAV.g - 1)*100 
## 10% 5% 0.5% 
## -1.9779 -1.4868 -0.4514 
# TVaR Gaussian vs Student dep. 
TVaR.NAV.t - mean(sort(NAV.t.last)[1:50]) 
(TVaR.NAV.t/TVaR.NAV.g - 1)*100 
## [1] -5.767
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
But still. . . 
I Historical stock prices are NOT lognormal. 
I Even though it’s based on real data, this was a “nice” 
example. 
I Try other models : Heston model (stochastic volatility) 
or Bates model (stochastic volatility with jumps 
diffusion) 
I Example : The package’s vignette explains how to 
make simulations of Bates model 
I But : 
I calibration must be carried out with care 
I validation of statistical properties as well
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Contents 
1. Context 
2. ESGtoolkit 
I About model risk 
I About discretization error 
I About calibration error
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
About discretization error 
I Example 
A Stochastic Differential Equation for an equilibrium short 
rate model (Vasicek model’s SDE) : 
drt = a( − rt )dt + dWt 
A simple and intuitive way to make simulations of the SDE : 
Euler scheme (1st order Ito development) : 
I Deterministic mean-reverting part 
rti+1 − rti = a( − rti )(ti+1 − ti ) + . . . 
I . . . A part with random shocks (  N(0, 1)) 
pti+1 − ti
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
About discretization error (cont’d) 
I Other method for the simulation of SDE : Milstein 
scheme (2nd order Ito development). But when e.g the 
volatility  is constant, it’s not necessary. Otherwise, 
leads to more complicated formulas. 
I Euler and Milstein schemes imply discretization bias. 
I Currently in ESGtoolkit, we use exact simulation of 
the transition distribution between ti+1 and ti =) No 
discretization bias. 
Here, using the SDE’s exact solution provides the following 
alternative scheme : 
s 
1 − e−a(ti+1−ti ) 
rti+1 = e−a(ti+1−ti )rti+(1−e−a(ti+1−ti ))+ 
2a
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
I Illustration using ESGtoolkit (set.seed(1)) 
m - 50 # number of projection dates 
n - 500 # number of simulations 
a - 0.5 # speed of mean-reversion 
theta - 0.02 # long term rate, mean-rev. level 
sigma - 0.001 # volatility 
# Short rate with Euler discretization 
r.Euler - matrix(0, nrow = m, ncol = n) 
for (i in 1:(m-1)) 
{r.Euler[i+1, ] - r.Euler[i, ] + a*(theta - 
r.Euler[i, ]) + sigma*rnorm(n)} 
# Short rate with Exact simulation (ESGtoolkit) 
r.Exact - simdiff(n = n, horizon = 50, 
model = OU, 
x0 = 0, theta1 = a*theta, 
theta2 = a, theta3 = sigma)
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
0.012 0.014 0.016 0.018 
0 100 300 500 
Visualizing discretization bias (t = 3 years) 
on the example, through densities 
N = 500 Bandwidth = 0.0003097 
Density 
Euler simulation 
Exact simulation (ESGtoolkit) 
0.016 0.018 0.020 0.022 
0 100 300 500 
Visualizing discretization bias (t = 5 years) 
on the example, through densities 
N = 500 Bandwidth = 0.0002621 
Density 
Euler simulation 
Exact simulation (ESGtoolkit) 
0.016 0.018 0.020 0.022 0.024 
0 100 300 500 
Visualizing discretization bias (t = 15 years) 
on the example, through densities 
N = 500 Bandwidth = 0.0002712 
Density 
Euler simulation 
Exact simulation (ESGtoolkit) 
0.016 0.018 0.020 0.022 0.024 
0 100 300 500 
Visualizing discretization bias (t = 45 years) 
on the example, through densities 
N = 500 Bandwidth = 0.000304 
Density 
Euler simulation 
Exact simulation (ESGtoolkit)
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
About discretization error (cont’d) 
I Comparing the implied zero-coupon prices 
price.Euler - rowMeans(exp(-apply(r.Euler, 2, 
cumsum))) 
price.Exact - rowMeans(exp(-apply(r.Exact, 2, 
cumsum))) 
(head(price.Exact)/head(price.Euler) - 1)*100 
## [1] 0.0000 0.2071 0.4452 0.6392 0.7936 0.9002
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Contents 
1. Context 
2. ESGtoolkit 
I About model risk 
I About discretization error 
I About calibration error
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Calibration (the Art of) 
I Choice of projection models parameters using 
market data 
I Real world 
I Methods of moments (Generalized, Simulated) 
I Maximum likelihood (or Quasi-Maximum likelihood, 
Normal approximation, Simulated maximum likelihood) 
I Non-linear filtering 
I Market Consistent (Risk-neutral) 
I Minimizing (for N given financial instruments) 
XN 
i=1 
wig(Price(i,Model) 
0 () − Price(i,Market) 
0 ) 
I With model parameters  2 Rd , weights (wi )i=1,...,N 
and for example : 
I g : x7! x2 
I g : x7! |x|
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Focus on market consistent calibration 
CRO Forum, in Extrapolation of Market Data (2010) 
I The complexity of the stochastic model used to value 
embedded options and guarantees is directly linked to 
the complexity of the underlying insurance contract 
I The complexity of the model used should take into 
account the complexity of the liability and its embedded 
equity guarantees [. . . ]. The calibration of any model 
should at least consider the at-the-money term-structure 
and for more complex models (e.g. Heston) should also 
consider the full volatility surface of the liquid part of the 
volatility market. This then automatically implies 
extrapolated volatilities for in- and out-the-money 
volatilities in the extrapolated part of the curve.
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Focus on market consistent calibration (cont’d) 
I Example : G2++ model (2-factor Hull  White) 
calibrated to ATM Euro Caps on December 31, 2011 
dxt = −axt + dW(x) 
t 
dyt = −byt + dW(y) 
t 
dW(x) 
t dW(y) 
t = dt 
rt = xt + yt + t 
I 5 parameters to find : a, b, , ,  
I Objective function with many local optima 
I Optimization with R package mcGlobaloptim 
I Monte Carlo simulation of multiple starting points in a 
given region 
I Running local optimizations 
I Finding the best parameters
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
Focus on market consistent calibration (cont’d) 
# Parameters found for the G2++ 
a_opt - 0.50000000 
b_opt - 0.35412030 
sigma_opt - 0.09416266 
rho_opt - -0.99855687 
eta_opt - 0.08439934 
horizon - 20 
n - 500 
freq - semi-annual 
delta_t - 1/2 
# Simulation of gaussian correlated shocks 
eps - simshocks(n = n, horizon = horizon, 
frequency = freq, 
method = anti, 
family = 1, par = rho_opt)
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
I Simulation of the model factors 
x - simdiff(n = n, horizon = horizon, 
frequency = freq, 
model = OU, 
x0 = 0, theta1 = 0, theta2 = a_opt, theta3 = sigma_eps = eps[[1]]) 
y - simdiff(n = n, horizon = horizon, 
frequency = freq, 
model = OU, 
x0 = 0, theta1 = 0, theta2 = b_opt, theta3 = eta_eps = eps[[2]])
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
I Forward rates and final model 
fwdrates - esgfwdrates(n = n, horizon = horizon, 
out.frequency = freq, in.maturities = u, 
in.zerorates = txZC, method = SW) 
fwdrates - window(fwdrates, end = horizon) 
t.out - seq(from = 0, to = horizon, 
by = delta_t) 
param.phi - 0.5*(sigma_opt^2)*(1 - 
exp(-a_opt*t.out))^2/(a_opt^2) + 
0.5*(eta_opt^2)*(1 - exp(-b_opt*t.out))^2/ 
(b_opt^2) + 
(rho_opt*sigma_opt*eta_opt)*(1 - exp(-a_opt*t.out))* 
(1 - exp(-b_opt*t.out))/(a_opt*b_opt)
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) I Forward rates and final model (cont’d) 
param.phi - ts(replicate(n, param.phi), 
start = start(x), deltat = deltat(x)) 
phi - fwdrates + param.phi 
colnames(phi) - c(paste0(Series , 1:n)) 
r - x + y + phi 
colnames(r) - c(paste0(Series , 1:n))
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
I The result 
esgplotbands(r, xlab = time, ylab = values, 
main = G2++ short rate) 
lines(rep(0, ncol(r)), col = red, lty = 2, lwd = 2) 
0 5 10 15 20 
−0.05 0.00 0.05 0.10 
G2++ short rate 
time 
values
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
I Monte Carlo prices of zero-coupons vs true prices 
5 10 15 20 
0.65 0.70 0.75 0.80 0.85 0.90 0.95 
1:horizon 
window(esgmcprices(r, 1), start = 0.5, deltat = 1) 
zero−coupon prices 
m.c G2++ zero−coupons
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
# Checking error manually 
pct.err - (window(esgmcprices(r, 1), 
start = 0.5, deltat = 1)/p[1:horizon] - 1)*100 
plot(pct.err) 
points(pct.err) 
Time 
pct.err 
0 5 10 15 20 
−0.20 −0.15 −0.10 −0.05 0.00
Economic 
Scenarios 
Generation for 
Insurance: 
ESGtoolkit (and 
friends) 
Thierry Moudiki 
(@moudikithierry) 
One further step is required 
I Verifying by simulation that the discounted Caps payoffs 
are martingales (Market consistency test) 
I Typically, a Student t-test 
I An example of Market consistency test can be found 
in the package vignette.

Contenu connexe

Similaire à Economic Scenarios Generators in R with ESGtoolkit

Introducing R package ESG at Rmetrics Paris 2014 conference
Introducing R package ESG at Rmetrics Paris 2014 conferenceIntroducing R package ESG at Rmetrics Paris 2014 conference
Introducing R package ESG at Rmetrics Paris 2014 conferenceThierry Moudiki
 
Fashion E-Commerce: Using Computer Vision to Find Clothing that Fits Like a G...
Fashion E-Commerce: Using Computer Vision to Find Clothing that Fits Like a G...Fashion E-Commerce: Using Computer Vision to Find Clothing that Fits Like a G...
Fashion E-Commerce: Using Computer Vision to Find Clothing that Fits Like a G...Ashwin Hariharan
 
Leverage Endpooint Visibilit with MITRE ATT&CK Framework
Leverage Endpooint Visibilit with MITRE ATT&CK FrameworkLeverage Endpooint Visibilit with MITRE ATT&CK Framework
Leverage Endpooint Visibilit with MITRE ATT&CK FrameworkDigit Oktavianto
 
Federico Thibaud - Capital Structure Arbitrage
Federico Thibaud - Capital Structure ArbitrageFederico Thibaud - Capital Structure Arbitrage
Federico Thibaud - Capital Structure ArbitrageFederico Thibaud
 
Coursework- Soton (Single Index Model and CAPM)
Coursework- Soton (Single Index Model and CAPM)Coursework- Soton (Single Index Model and CAPM)
Coursework- Soton (Single Index Model and CAPM)Ece Akbulut
 
2011 02-04 - d sallier - prévision probabiliste
2011 02-04 - d sallier - prévision probabiliste2011 02-04 - d sallier - prévision probabiliste
2011 02-04 - d sallier - prévision probabilisteCdiscount
 
Learning Security Strategies through Game Play and Optimal Stopping
Learning Security Strategies through Game Play and Optimal StoppingLearning Security Strategies through Game Play and Optimal Stopping
Learning Security Strategies through Game Play and Optimal StoppingKim Hammar
 
Varied encounters with data science (slide share)
Varied encounters with data science (slide share)Varied encounters with data science (slide share)
Varied encounters with data science (slide share)gilbert.peffer
 
03 GlobalAIBootcamp2020Lisboa-Rock, Paper, Scissors.pptx
03 GlobalAIBootcamp2020Lisboa-Rock, Paper, Scissors.pptx03 GlobalAIBootcamp2020Lisboa-Rock, Paper, Scissors.pptx
03 GlobalAIBootcamp2020Lisboa-Rock, Paper, Scissors.pptxLuis Beltran
 
Criticism on Li's Copula Approach
Criticism on Li's Copula ApproachCriticism on Li's Copula Approach
Criticism on Li's Copula ApproachOleguer Sagarra
 
Machine Learning and Social Good
Machine Learning and Social GoodMachine Learning and Social Good
Machine Learning and Social GoodSplunk
 
Professional AI projects the easy way slides
Professional AI projects the easy way slidesProfessional AI projects the easy way slides
Professional AI projects the easy way slidesNuSpace
 
Project on a Business Plan for the Solar system installation on Residential b...
Project on a Business Plan for the Solar system installation on Residential b...Project on a Business Plan for the Solar system installation on Residential b...
Project on a Business Plan for the Solar system installation on Residential b...Rifat Abdul Rahiman
 
Open source migration in public sector
Open source migration in public sectorOpen source migration in public sector
Open source migration in public sectorAndroklis Mavridis
 
Self-Learning Systems for Cyber Defense
Self-Learning Systems for Cyber DefenseSelf-Learning Systems for Cyber Defense
Self-Learning Systems for Cyber DefenseKim Hammar
 
Key Outputs of the E-CRIME project
Key Outputs of the E-CRIME projectKey Outputs of the E-CRIME project
Key Outputs of the E-CRIME projectTrilateral Research
 
MITRE ATTACKcon Power Hour - January
MITRE ATTACKcon Power Hour - JanuaryMITRE ATTACKcon Power Hour - January
MITRE ATTACKcon Power Hour - JanuaryMITRE - ATT&CKcon
 
No estimates - 10 new principles for testing
No estimates  - 10 new principles for testingNo estimates  - 10 new principles for testing
No estimates - 10 new principles for testingVasco Duarte
 

Similaire à Economic Scenarios Generators in R with ESGtoolkit (20)

Introducing R package ESG at Rmetrics Paris 2014 conference
Introducing R package ESG at Rmetrics Paris 2014 conferenceIntroducing R package ESG at Rmetrics Paris 2014 conference
Introducing R package ESG at Rmetrics Paris 2014 conference
 
Fashion E-Commerce: Using Computer Vision to Find Clothing that Fits Like a G...
Fashion E-Commerce: Using Computer Vision to Find Clothing that Fits Like a G...Fashion E-Commerce: Using Computer Vision to Find Clothing that Fits Like a G...
Fashion E-Commerce: Using Computer Vision to Find Clothing that Fits Like a G...
 
Leverage Endpooint Visibilit with MITRE ATT&CK Framework
Leverage Endpooint Visibilit with MITRE ATT&CK FrameworkLeverage Endpooint Visibilit with MITRE ATT&CK Framework
Leverage Endpooint Visibilit with MITRE ATT&CK Framework
 
Federico Thibaud - Capital Structure Arbitrage
Federico Thibaud - Capital Structure ArbitrageFederico Thibaud - Capital Structure Arbitrage
Federico Thibaud - Capital Structure Arbitrage
 
QEAD .docx
QEAD                                                        .docxQEAD                                                        .docx
QEAD .docx
 
Coursework- Soton (Single Index Model and CAPM)
Coursework- Soton (Single Index Model and CAPM)Coursework- Soton (Single Index Model and CAPM)
Coursework- Soton (Single Index Model and CAPM)
 
2011 02-04 - d sallier - prévision probabiliste
2011 02-04 - d sallier - prévision probabiliste2011 02-04 - d sallier - prévision probabiliste
2011 02-04 - d sallier - prévision probabiliste
 
Learning Security Strategies through Game Play and Optimal Stopping
Learning Security Strategies through Game Play and Optimal StoppingLearning Security Strategies through Game Play and Optimal Stopping
Learning Security Strategies through Game Play and Optimal Stopping
 
Varied encounters with data science (slide share)
Varied encounters with data science (slide share)Varied encounters with data science (slide share)
Varied encounters with data science (slide share)
 
03 GlobalAIBootcamp2020Lisboa-Rock, Paper, Scissors.pptx
03 GlobalAIBootcamp2020Lisboa-Rock, Paper, Scissors.pptx03 GlobalAIBootcamp2020Lisboa-Rock, Paper, Scissors.pptx
03 GlobalAIBootcamp2020Lisboa-Rock, Paper, Scissors.pptx
 
Criticism on Li's Copula Approach
Criticism on Li's Copula ApproachCriticism on Li's Copula Approach
Criticism on Li's Copula Approach
 
Machine Learning and Social Good
Machine Learning and Social GoodMachine Learning and Social Good
Machine Learning and Social Good
 
Professional AI projects the easy way slides
Professional AI projects the easy way slidesProfessional AI projects the easy way slides
Professional AI projects the easy way slides
 
Project on a Business Plan for the Solar system installation on Residential b...
Project on a Business Plan for the Solar system installation on Residential b...Project on a Business Plan for the Solar system installation on Residential b...
Project on a Business Plan for the Solar system installation on Residential b...
 
Open source migration in public sector
Open source migration in public sectorOpen source migration in public sector
Open source migration in public sector
 
Self-Learning Systems for Cyber Defense
Self-Learning Systems for Cyber DefenseSelf-Learning Systems for Cyber Defense
Self-Learning Systems for Cyber Defense
 
Key Outputs of the E-CRIME project
Key Outputs of the E-CRIME projectKey Outputs of the E-CRIME project
Key Outputs of the E-CRIME project
 
MITRE ATTACKcon Power Hour - January
MITRE ATTACKcon Power Hour - JanuaryMITRE ATTACKcon Power Hour - January
MITRE ATTACKcon Power Hour - January
 
No estimates - 10 new principles for testing
No estimates  - 10 new principles for testingNo estimates  - 10 new principles for testing
No estimates - 10 new principles for testing
 
Decision Making Process
Decision Making ProcessDecision Making Process
Decision Making Process
 

Dernier

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 

Dernier (20)

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 

Economic Scenarios Generators in R with ESGtoolkit

  • 1. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Institut de Sciences Financières et d’Assurances, Université Lyon 1 Thierry Moudiki (@moudikithierry) September 26, 2014
  • 2. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry)
  • 3. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Contents 1. Context 2. ESGtoolkit I About model risk I About discretization error I About calibration error
  • 4. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Why ? I As an insurer, basically : I How much should I keep aside today at t = 0, for the payment of a guaranteed compensation tomorrow at t = T: Liabs0 = BestEstimateLiabs0 + Margin0 =) Reserving : pricing the guaranteed compensation I Having calculated Liabs0, I’d like to derive x 0, so that : P(AssetsT − LiabsT x) 1 − % =) Capital modeling : determining the future distribution of my Own Funds
  • 5. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Why ? (cont’d) Regulatory point of view I Market Consistent Embedded value (MCEV) : Time Value of Financial Options Guarantees (TVOFG) I **Solvency II : I ** Best Estimate valuation of the technical reserves (BEL) I Solvency II : Own Risk Solvency Assessment (ORSA) But : I For pricing (reserving) : not always closed formulas available for pricing the guarantees (risk asymmetry induced by the optional features) I For capital modeling : not always (never !) entirely-specified probability distributions available for the Own Funds
  • 6. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Context What ? From what’s been said : Modeling and simulation of risk factors are needed. ESG : Economic Scenarios Generator I Tool for modeling and simulation of economic factors’ future values I Purpose : Asset Liability Management in Banking and Insurance. I Our focus : Insurance
  • 7. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) How ? How can we do that ? I With Monte Carlo simulation I But also, Bootstrapping can be used Generally, 2 types of simulations I Real-world simulations under the objective probability : for capital modeling I Risk-neutral simulations under a martingale probability measure : for reserving/pricing
  • 8. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) The package ESGtoolkit Thierry Moudiki (@moudikithierry) I An R package providing tools, for constructing custom Economic Scenario Generators (ESG) I Version 0.1 released in june 2014 I A vignette is available (now in PDF, in HTML soon) I Under development I Suggestions, bug reports, and features request are welcome.
  • 9. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Why R ? I The language of Analytics; 2 million users worldwide (Source : Seven quick facts about R) I Free + Open source I Over 5800 contributed packages on CRAN repository, doing almost anything you could think of (Visit : the Task Views) I “Researchers in statistics and machine learning will often publish an R package to accompany their articles. This means immediate access to the very latest statistical techniques and implementations.” Hadley Wickham (RStudio)
  • 10. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Contents 1. Context 2. ESGtoolkit I About model risk I About discretization error I About calibration error
  • 11. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) ESGtoolkit I Currently, 3 main functions I simdiff (underlying C++ code via Rcpp) : I Ornstein-Uhlenbeck process simulation I Cox-Ingersoll-Ross process simulation I Geometric Brownian motion with constant or time-dependent drift or volatility, and optional (lognormal or double-exponential) jumps I simshocks : I simulation of gaussian shocks with highly flexible dependence structure I esgfwdrates : I instantaneous forward rates for no-arbitrage short rate models I And additional functions for diagnostics : esgplotbands, esgplotshocks, esgplotmartingaletest, . . .
  • 12. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) ESGtoolkit ESGtoolkit current structure simshocks (Gaussian, Student t, Clayton ...) simdiff (OU, CIR, GBM−likes) esgfwdrates (Nelson−Siegel, Smith−Wilson ...) various models (Vasicek, BS, Merton, Heston, Bates...) no−arbitrage short rates models (HW, G2++, CIR++, BK, ...)
  • 13. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) However, remember I “Essentially, all models are wrong, but some are useful” George E. P. Box I . . . also, some can lead to disasters.
  • 14. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) From Felix Salmon’s Recipe for Disaster: The Formula That Killed Wall Street (available online)
  • 15. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) However, remember 3 types of risks in the process of modeling and simulation of risk factors : I Model risk I Choice of the model I Choice of the dependence structure I Discretization error I Calibration error
  • 16. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Contents 1. Context 2. ESGtoolkit I About model risk I About discretization error I About calibration error
  • 17. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) About model risk Choice of the model and choice of the dependence structure A simple example : Insurance company, ABC corp., that has, on December 30, 2011, 2 assets in its portfolio : A0 = Nominal × (40%CAC 40 + 60%SP 500) The liabilities on December 30, 2011 are : L0 = 45% × A0 ABC corp. has to pay daily guaranteed benefits K to the insured, plus an additional benefits depending on the daily performance of the assets : 8i 0, Li = Li−1 − K × 1 + 95%max Ai Ai−1 − 1, 0
  • 18. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Analyst wants to assess ABC corp.’s 6-month solvency and uses R # loading the package quantmod # to obtain financial index time series library(quantmod) # Importing the values of the CAC40 and SP500 # CAC40, as a time series (ts) object getSymbols('^FCHI', src='yahoo', return.class = 'ts', from = 2011-06-30, to = 2011-12-30) # SP500, as a time series (ts) object getSymbols('^GSPC', src='yahoo', return.class = 'ts', from = 2011-06-27, to = 2011-12-30)
  • 19. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) The type of data we can get from quantmod head(FCHI)[, 1:4] ## FCHI.Open FCHI.High FCHI.Low FCHI.Close ## [1,] 3937 3982 3926 3982 ## [2,] 3982 4024 3967 4007 ## [3,] 4010 4010 3997 4003 ## [4,] 3997 3999 3974 3979 ## [5,] 3981 3982 3942 3961 ## [6,] 3982 4020 3960 3980
  • 20. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) I Using the closing prices S (CAC) Thierry Moudiki (@moudikithierry) t , S(SP) t analyst calculates the daily log-returns log 0 @S(CAC) ti+1 S(CAC) ti 1 A and log 0 @S(SP) ti+1 S(SP) ti 1 A
  • 21. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Normality of the log-returns ? Histogram of log.ret.CAC log.ret.CAC Frequency −0.06 −0.04 −0.02 0.00 0.02 0.04 0.06 0 5 10 15 20 25 −2 −1 0 1 2 −0.06 −0.02 0.02 0.06 Normal Q−Q Plot Theoretical Quantiles Sample Quantiles Histogram of log.ret.SP log.ret.SP Frequency −0.06 −0.04 −0.02 0.00 0.02 0.04 0 5 10 15 20 25 30 −2 −1 0 1 2 −0.06 −0.02 0.02 Normal Q−Q Plot Theoretical Quantiles Sample Quantiles
  • 22. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Normality of the log-returns ? (cont’d) shapiro.test(log.ret.CAC) ## ## Shapiro-Wilk normality test ## ## data: log.ret.CAC ## W = 0.9906, p-value = 0.5268 shapiro.test(log.ret.SP) ## ## Shapiro-Wilk normality test ## ## data: log.ret.SP ## W = 0.9827, p-value = 0.0962
  • 23. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Maximum likelihood estimation I Analyst assumes that : I the distribution of the assets over the next 6 months will be the same that she observed in the last 6-months period. Maximum likelihood is used to calibrate the lognormal models : # Parameters for the projection of the CAC 40 delta - 1/252 # for daily sampling sigma.CAC - sqrt((n-1)/n)*sd(log.ret.CAC)/sqrt(delta) mu.CAC - mean(log.ret.CAC)/delta + 0.5*sigma.CAC^2
  • 24. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Correlation ? I Based on : I the histograms I the Normal qqplot I the results of the tests (Normality not rejected) ABC corp.’s analyst assumes that the distribution of the assets on the period of interest is lognormal. I But she now wants to know more about the dependence between the assets
  • 25. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Correlation ? (cont’d) I Visualizing the indices on the 6-month period, and the log-returns CAC 40 Time S.CAC 0 20 40 60 80 100 120 2800 3400 4000 SP 500 Time S.SP 0 20 40 60 80 100 120 1100 1200 1300 0 20 40 60 80 100 120 −0.06 0.00 0.04 log−returns Index log.ret.CAC
  • 26. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Correlation ? (cont’d) I She decides to I assume that the assets are correlated (Gaussian dependence). The correlation coefficients between the shocks is : U.S.CAC - pnorm((log.ret.CAC - mean(log.ret.CAC)) /sd(log.ret.CAC)) U.S.SP - pnorm((log.ret.SP - mean(log.ret.SP))/ sd(log.ret.SP)) (correlation - cor(U.S.CAC, U.S.SP)) ## [1] 0.3852
  • 27. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Correlation ? (cont’d) However. . . # Package CDVine : Statistical inference of # canonical vine (C-vine) and D-vine copulas library(CDVine) copula.selection - BiCopSelect(U.S.CAC, U.S.SP) print(c(copula.selection$family, copula.selection$par, Thierry Moudiki (@moudikithierry) copula.selection$par2)) ## [1] 2.0000 0.4227 9.1056 I R package CDVine (see jstatsoft paper) says : I Student t dependence, with 9.11 degrees of freedom, and dependence parameter equal to 0.42
  • 28. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) I Simulation of shocks with ESGtoolkit library(ESGtoolkit) # Nb of simulations, horizon, and frequency nb - 10000 horizon - 1 freq - daily # Simulation of shocks set.seed(1) # With student dependence eps.student - simshocks(n = nb, horizon = horizon, frequency = freq, family = copula.selection$family, par = copula.selection$par, par2 = copula.selection$par2)
  • 29. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) I Simulation of future values of assets with simdiff Simulation with Gaussian dependence is exactly the same, but uses eps.gaussian for the shocks # With Student dependence # CAC 40 sim.CAC.t - window(simdiff(n = nb, horizon = horizon, model = GBM, frequency = freq, x0 = S.CAC[n], theta1 = mu.CAC, theta2 = sigma.CAC, eps = eps.student[[1]]), end = 0.5) # SP 500 sim.SP.t - window(simdiff(n = nb, horizon = horizon, model = GBM, frequency = freq, x0 = S.SP[n], theta1 = mu.SP, theta2 = sigma.SP, eps = eps.student[[2]]), end = 0.5)
  • 30. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) I Visualizing the projections of assets’ values with esgplotbands par(mfrow = c(2, 2)) esgplotbands(sim.CAC.t, xlab = time, ylab = index values) lines(S.CAC.future, col = red) esgplotbands(sim.SP.t, xlab = time, ylab = index values) lines(S.SP.future, col = blue) esgplotbands(sim.CAC.g, xlab = time, ylab = index values) lines(S.CAC.future, col = red) esgplotbands(sim.SP.g, xlab = time, ylab = index values) lines(S.SP.future, col = blue)
  • 31. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) I Visualizing the projections of assets’ values with esgplotbands. The true values (from January to June 2012) are the red lines and the blue lines. 0.0 0.1 0.2 0.3 0.4 0.5 1000 2000 3000 4000 5000 6000 7000 8000 CAC 40 projection (Student dependence) time index values 0.0 0.1 0.2 0.3 0.4 0.5 500 1000 1500 2000 2500 SP 500 projection (Student dependence) time index values 0.0 0.1 0.2 0.3 0.4 0.5 1000 2000 3000 4000 5000 6000 7000 CAC 40 projection (gaussian dependence) time index values 0.0 0.1 0.2 0.3 0.4 0.5 500 1000 1500 2000 2500 3000 SP 500 projection (gaussian dependence) time index values
  • 32. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) I Assets and Liabilities simulation for the Net Asset Value (the whole code is available) ### The insurer's Asset w1 - 0.4 w2 - 1-w1 Nominal - 100000 # With gaussian dependence S.g - Nominal*(w1*sim.CAC.g + w2*sim.SP.g) # With Student t dependence S.t - Nominal*(w1*sim.CAC.t + w2*sim.SP.t) ### The insurer's liability # With gaussian and Student t dependence (at t=0) L0.g - L0.t - S.g[1,1]*0.45 # Guaranteed capital K - 80 # Pct. for additional benefits pct.PB - .95
  • 33. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) I Assets and Liabilities simulation for the Net Asset Value # variation of liabilities fact.growth.t - -K*(1 + pct.PB*(S.t.mat[-1, ]/ S.t.mat[-nrowS, ] - 1)* (S.t.mat[-1, ]/S.t.mat[-nrowS, ] - 1 0)) # Liabilities simulation (Student) L.t - ts(apply(rbind(rep(L0.t, ncolS), fact.growth.t), 2, cumsum), start = start(S.t), deltat = deltat(S.t)) # Net Asset Value NAV.t - S.t - L.t
  • 34. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) I Estimating the 6-month required capital with Gaussian and Student dependences (the whole code is available) # VaR Gaussian vs Student dep. qt.NAV.t - quantile(NAV.t.last, probs = 1 - c(0.9, 0.95, 0.995)) (qt.NAV.t/qt.NAV.g - 1)*100 ## 10% 5% 0.5% ## -1.9779 -1.4868 -0.4514 # TVaR Gaussian vs Student dep. TVaR.NAV.t - mean(sort(NAV.t.last)[1:50]) (TVaR.NAV.t/TVaR.NAV.g - 1)*100 ## [1] -5.767
  • 35. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) But still. . . I Historical stock prices are NOT lognormal. I Even though it’s based on real data, this was a “nice” example. I Try other models : Heston model (stochastic volatility) or Bates model (stochastic volatility with jumps diffusion) I Example : The package’s vignette explains how to make simulations of Bates model I But : I calibration must be carried out with care I validation of statistical properties as well
  • 36. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Contents 1. Context 2. ESGtoolkit I About model risk I About discretization error I About calibration error
  • 37. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) About discretization error I Example A Stochastic Differential Equation for an equilibrium short rate model (Vasicek model’s SDE) : drt = a( − rt )dt + dWt A simple and intuitive way to make simulations of the SDE : Euler scheme (1st order Ito development) : I Deterministic mean-reverting part rti+1 − rti = a( − rti )(ti+1 − ti ) + . . . I . . . A part with random shocks ( N(0, 1)) pti+1 − ti
  • 38. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) About discretization error (cont’d) I Other method for the simulation of SDE : Milstein scheme (2nd order Ito development). But when e.g the volatility is constant, it’s not necessary. Otherwise, leads to more complicated formulas. I Euler and Milstein schemes imply discretization bias. I Currently in ESGtoolkit, we use exact simulation of the transition distribution between ti+1 and ti =) No discretization bias. Here, using the SDE’s exact solution provides the following alternative scheme : s 1 − e−a(ti+1−ti ) rti+1 = e−a(ti+1−ti )rti+(1−e−a(ti+1−ti ))+ 2a
  • 39. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) I Illustration using ESGtoolkit (set.seed(1)) m - 50 # number of projection dates n - 500 # number of simulations a - 0.5 # speed of mean-reversion theta - 0.02 # long term rate, mean-rev. level sigma - 0.001 # volatility # Short rate with Euler discretization r.Euler - matrix(0, nrow = m, ncol = n) for (i in 1:(m-1)) {r.Euler[i+1, ] - r.Euler[i, ] + a*(theta - r.Euler[i, ]) + sigma*rnorm(n)} # Short rate with Exact simulation (ESGtoolkit) r.Exact - simdiff(n = n, horizon = 50, model = OU, x0 = 0, theta1 = a*theta, theta2 = a, theta3 = sigma)
  • 40. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) 0.012 0.014 0.016 0.018 0 100 300 500 Visualizing discretization bias (t = 3 years) on the example, through densities N = 500 Bandwidth = 0.0003097 Density Euler simulation Exact simulation (ESGtoolkit) 0.016 0.018 0.020 0.022 0 100 300 500 Visualizing discretization bias (t = 5 years) on the example, through densities N = 500 Bandwidth = 0.0002621 Density Euler simulation Exact simulation (ESGtoolkit) 0.016 0.018 0.020 0.022 0.024 0 100 300 500 Visualizing discretization bias (t = 15 years) on the example, through densities N = 500 Bandwidth = 0.0002712 Density Euler simulation Exact simulation (ESGtoolkit) 0.016 0.018 0.020 0.022 0.024 0 100 300 500 Visualizing discretization bias (t = 45 years) on the example, through densities N = 500 Bandwidth = 0.000304 Density Euler simulation Exact simulation (ESGtoolkit)
  • 41. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) About discretization error (cont’d) I Comparing the implied zero-coupon prices price.Euler - rowMeans(exp(-apply(r.Euler, 2, cumsum))) price.Exact - rowMeans(exp(-apply(r.Exact, 2, cumsum))) (head(price.Exact)/head(price.Euler) - 1)*100 ## [1] 0.0000 0.2071 0.4452 0.6392 0.7936 0.9002
  • 42. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Contents 1. Context 2. ESGtoolkit I About model risk I About discretization error I About calibration error
  • 43. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Calibration (the Art of) I Choice of projection models parameters using market data I Real world I Methods of moments (Generalized, Simulated) I Maximum likelihood (or Quasi-Maximum likelihood, Normal approximation, Simulated maximum likelihood) I Non-linear filtering I Market Consistent (Risk-neutral) I Minimizing (for N given financial instruments) XN i=1 wig(Price(i,Model) 0 () − Price(i,Market) 0 ) I With model parameters 2 Rd , weights (wi )i=1,...,N and for example : I g : x7! x2 I g : x7! |x|
  • 44. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Focus on market consistent calibration CRO Forum, in Extrapolation of Market Data (2010) I The complexity of the stochastic model used to value embedded options and guarantees is directly linked to the complexity of the underlying insurance contract I The complexity of the model used should take into account the complexity of the liability and its embedded equity guarantees [. . . ]. The calibration of any model should at least consider the at-the-money term-structure and for more complex models (e.g. Heston) should also consider the full volatility surface of the liquid part of the volatility market. This then automatically implies extrapolated volatilities for in- and out-the-money volatilities in the extrapolated part of the curve.
  • 45. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Focus on market consistent calibration (cont’d) I Example : G2++ model (2-factor Hull White) calibrated to ATM Euro Caps on December 31, 2011 dxt = −axt + dW(x) t dyt = −byt + dW(y) t dW(x) t dW(y) t = dt rt = xt + yt + t I 5 parameters to find : a, b, , , I Objective function with many local optima I Optimization with R package mcGlobaloptim I Monte Carlo simulation of multiple starting points in a given region I Running local optimizations I Finding the best parameters
  • 46. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) Focus on market consistent calibration (cont’d) # Parameters found for the G2++ a_opt - 0.50000000 b_opt - 0.35412030 sigma_opt - 0.09416266 rho_opt - -0.99855687 eta_opt - 0.08439934 horizon - 20 n - 500 freq - semi-annual delta_t - 1/2 # Simulation of gaussian correlated shocks eps - simshocks(n = n, horizon = horizon, frequency = freq, method = anti, family = 1, par = rho_opt)
  • 47. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) I Simulation of the model factors x - simdiff(n = n, horizon = horizon, frequency = freq, model = OU, x0 = 0, theta1 = 0, theta2 = a_opt, theta3 = sigma_eps = eps[[1]]) y - simdiff(n = n, horizon = horizon, frequency = freq, model = OU, x0 = 0, theta1 = 0, theta2 = b_opt, theta3 = eta_eps = eps[[2]])
  • 48. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) I Forward rates and final model fwdrates - esgfwdrates(n = n, horizon = horizon, out.frequency = freq, in.maturities = u, in.zerorates = txZC, method = SW) fwdrates - window(fwdrates, end = horizon) t.out - seq(from = 0, to = horizon, by = delta_t) param.phi - 0.5*(sigma_opt^2)*(1 - exp(-a_opt*t.out))^2/(a_opt^2) + 0.5*(eta_opt^2)*(1 - exp(-b_opt*t.out))^2/ (b_opt^2) + (rho_opt*sigma_opt*eta_opt)*(1 - exp(-a_opt*t.out))* (1 - exp(-b_opt*t.out))/(a_opt*b_opt)
  • 49. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) I Forward rates and final model (cont’d) param.phi - ts(replicate(n, param.phi), start = start(x), deltat = deltat(x)) phi - fwdrates + param.phi colnames(phi) - c(paste0(Series , 1:n)) r - x + y + phi colnames(r) - c(paste0(Series , 1:n))
  • 50. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) I The result esgplotbands(r, xlab = time, ylab = values, main = G2++ short rate) lines(rep(0, ncol(r)), col = red, lty = 2, lwd = 2) 0 5 10 15 20 −0.05 0.00 0.05 0.10 G2++ short rate time values
  • 51. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) I Monte Carlo prices of zero-coupons vs true prices 5 10 15 20 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1:horizon window(esgmcprices(r, 1), start = 0.5, deltat = 1) zero−coupon prices m.c G2++ zero−coupons
  • 52. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) # Checking error manually pct.err - (window(esgmcprices(r, 1), start = 0.5, deltat = 1)/p[1:horizon] - 1)*100 plot(pct.err) points(pct.err) Time pct.err 0 5 10 15 20 −0.20 −0.15 −0.10 −0.05 0.00
  • 53. Economic Scenarios Generation for Insurance: ESGtoolkit (and friends) Thierry Moudiki (@moudikithierry) One further step is required I Verifying by simulation that the discounted Caps payoffs are martingales (Market consistency test) I Typically, a Student t-test I An example of Market consistency test can be found in the package vignette.