summaryrefslogtreecommitdiffstats
path: root/R/tranche_functions.R
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@serenitascapital.com>2014-08-13 14:44:09 -0400
committerGuillaume Horel <guillaume.horel@serenitascapital.com>2014-08-13 14:44:09 -0400
commit3d1c418a183371bcb663153f8b53f2a5ac5ce6b5 (patch)
tree0c6c023595f05543ecfab486f16db9cb48e536d9 /R/tranche_functions.R
parent7d402dd37f2b735dcca547412feb534ea1336efe (diff)
downloadlossdistrib-3d1c418a183371bcb663153f8b53f2a5ac5ce6b5.tar.gz
take into account the tranche factors. I hope this is right...
Diffstat (limited to 'R/tranche_functions.R')
-rw-r--r--R/tranche_functions.R10
1 files 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){