From 3d1c418a183371bcb663153f8b53f2a5ac5ce6b5 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Wed, 13 Aug 2014 14:44:09 -0400 Subject: take into account the tranche factors. I hope this is right... --- R/tranche_functions.R | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/R/tranche_functions.R b/R/tranche_functions.R index fb8a4fa..2f55a95 100644 --- a/R/tranche_functions.R +++ b/R/tranche_functions.R @@ -740,8 +740,8 @@ BCtranche.delta <- function(index, tradedate = Sys.Date()){ bp[,j] <- temp$bp } - deltas <- (bp[,2]-bp[,3])/(indexbp[2]-indexbp[3]) - deltasplus <- (bp[,4]-bp[,1])/(indexbp[4]-indexbp[1]) + deltas <- (bp[,2]-bp[,3])/(indexbp[2]-indexbp[3])*tranche.factor(index)/index$factor + deltasplus <- (bp[,4]-bp[,1])/(indexbp[4]-indexbp[1])*tranche.factor(index)/index$factor gammas <- (deltasplus-deltas)/(indexbp[2]-indexbp[1])/100 return( list(deltas=deltas, gammas=gammas) ) @@ -807,12 +807,10 @@ skewmapping <- function(index1, rhofun, index2, K2, Z, w, N=101) { } -delta.factor <- function(K1, K2, index){ +tranche.factor <- function(index){ ## compute the factor to convert from delta on current notional to delta on original notional ## K1 and K2 original strikes - factor <- (adjust.attachments(K2, index$loss, index$factor) - -adjust.attachments(K1, index$loss, index$factor))/(K2-K1) - return( factor ) + return( diff(index$K)/diff(index$K.orig)*index$factor ) } MFupdate.prob <- function(Z, w, rho, defaultprob){ -- cgit v1.2.3-70-g09d2