diff options
Diffstat (limited to 'R/calibrate_tranches_BC.R')
| -rw-r--r-- | R/calibrate_tranches_BC.R | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/R/calibrate_tranches_BC.R b/R/calibrate_tranches_BC.R index 5b9d69d0..b002e515 100644 --- a/R/calibrate_tranches_BC.R +++ b/R/calibrate_tranches_BC.R @@ -16,7 +16,7 @@ n.int <- 250 attach(GHquad(n.int))
Ngrid <- 201
-alldates <- seq(as.Date("2014-01-01"), as.Date("2014-01-05"), by="1 day")
+alldates <- seq(as.Date("2014-03-04"), as.Date("2014-01-05"), by="1 day")
aux <- function(rho, index, N, K, quote){
temp <- BClossdistC(index$defaultprob, index$issuerweights, index$recov, rho, Z, w, N)
@@ -24,7 +24,7 @@ aux <- function(rho, index, N, K, quote){ }
bus.dates <- as.Date(names(which(isBusinessDay(calendar="UnitedStates/GovernmentBond", alldates))))
-for(index.name in c("hy19", "hy21"){
+for(index.name in c("hy19")){
rhomat <- c()
deltasmat <- c()
gammasmat <- c()
@@ -43,10 +43,10 @@ for(index.name in c("hy19", "hy21"){ index$cs$coupons <- dT*index$tranche.running[j]
## we compute the 0-index$K[j+1] equivalent quote using the coupon of the jth quote
if(j==1){
- q <- index$quotes[j]*index$K[j+1]
+ q <- index$tranche.quotes[j]*index$K[j+1]
}else{
q <- BCtranche.pv(index, 0, index$K[j], 0, rhovec[j], Z, w, Ngrid, TRUE)$bp * index$K[j]+
- index$quotes[j]*(index$K[j+1]-index$K[j])
+ index$tranche.quotes[j]*(index$K[j+1]-index$K[j])
}
rho <- optimize(aux, interval=c(0,1), index=index, N=Ngrid, K=index$K[j+1], quote=q)$minimum
rhovec <- c(rhovec, rho)
|
