diff options
| -rw-r--r-- | R/calibrate_tranches_BC.R | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/R/calibrate_tranches_BC.R b/R/calibrate_tranches_BC.R index 48d228cc..4699f87b 100644 --- a/R/calibrate_tranches_BC.R +++ b/R/calibrate_tranches_BC.R @@ -95,10 +95,9 @@ for(i in 2:length(Kmodified)){ defaultprob, issuerweights, recov, Ngrid, Kmodified, cs, q)$minimum
rhovec <- c(rhovec, rho)
}
-
+rhovec <- c(0, rhovec)
##compute deltas by blipping the curves
-rhovec <- c(0, rhovec)
portfolioplus <- tweakportfolio(hy21portfolio.tweaked, 1e-4)
defaultprobplus <- 1 - SPmatrix(portfolioplus, length(cs$dates))
portfoliominus <- tweakportfolio(hy21portfolio.tweaked, -1e-4)
@@ -114,3 +113,9 @@ dPVtranche <- diff(c(0, test[,1]))/dK - diff(c(0, test[,2]))/dK dPVindex <- indexpv(portfoliominus, hy21, tradedate=tradedate, clean=FALSE)$bp-
indexpv(portfolioplus, hy21, tradedate=tradedate, clean=FALSE)$bp
deltas <- dPVtranche/dPVindex
+
+##use BCtranche.delta function
+deltas <- rep(0, 6)
+for(i in 1:6){
+ deltas[i] <- BCtranche.delta(hy21portfolio.tweaked, hy21, 0.05, K[i], K[i+1], rhovec[i], rhovec[i+1], Z, w, Ngrid, tradedate)
+}
|
