From a4c9aa862fbf2891cb8abfae2ac7ef9558ae207b Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Thu, 14 Aug 2014 10:57:49 -0400 Subject: new adjust.skew function for different index mapping --- R/tranche_functions.R | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'R/tranche_functions.R') diff --git a/R/tranche_functions.R b/R/tranche_functions.R index 2f55a95..c9b1ee1 100644 --- a/R/tranche_functions.R +++ b/R/tranche_functions.R @@ -691,16 +691,20 @@ BCtranche.pv <- function(index, protection=FALSE){ return(list(pl=plvec, cl=clvec, bp=bp)) } -theta.adjust.skew <- function(index, shortened=4){ - #ajust the correlation skew by doing ATM mapping on the expected loss +adjust.skew <- function(index, el1){ el <- EL(index) - elshort <- EL(index, shortened=shortened) K <- index$K[-c(1,length(index$K))] rhofun <- splinefun(K, index$rho[-c(1, length(index$rho))], "natural") - K <- el/elshort*K + K <- el/el1*K return(c(0, rhofun(K), NA)) } +theta.adjust.skew <- function(index, shortened=4){ + #ajust the correlation skew by doing ATM mapping on the expected loss + elshort <- EL(index, shortened=shortened) + return(adjust.skew(index, elshort)) +} + BCtranche.theta <- function(index, tradedate=Sys.Date(), shortened=4){ temp <- BCtranche.pv(index) index$rho <- theta.adjust.skew(index, shortened) -- cgit v1.2.3-70-g09d2