diff options
Diffstat (limited to 'R')
| -rw-r--r-- | R/tranche_functions.R | 10 |
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){
|
