aboutsummaryrefslogtreecommitdiffstats
path: root/R/calibrate_tranches.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/calibrate_tranches.R')
-rw-r--r--R/calibrate_tranches.R9
1 files changed, 5 insertions, 4 deletions
diff --git a/R/calibrate_tranches.R b/R/calibrate_tranches.R
index f71ec719..55315587 100644
--- a/R/calibrate_tranches.R
+++ b/R/calibrate_tranches.R
@@ -59,14 +59,14 @@ for(i in 1:nrow(nondefaulted)){
}
issuerweights <- rep(1/length(hy19portfolio), length(hy19portfolio))
-hy19$indexref <- 1.0125
+hy19$indexref <- 1.025
hy19portfolio.tweaked <- tweakcurves(hy19portfolio, hy19)
SurvProb <- SPmatrix(hy19portfolio.tweaked, hy19)
## load common parameters
K <- c(0, 0.15, 0.25, 0.35, 1)
Kmodified <- adjust.attachments(K, hy19$loss, hy19$factor)
-tranche.upf <- c(40.625, 94.15, 105.6525, 116)
+tranche.upf <- c(42.25, 95.375, 108.28125, 116.8125)
tranche.running <- c(0.05, 0.05, 0.05, 0.05)
Ngrid <- 2*nrow(nondefaulted)+1
@@ -110,7 +110,7 @@ defaultprob <- 1 - SurvProb
p <- defaultprob
rho <- 0.45
-clusterExport(cl, list("shockprob", "issuerweights", "rho", "Z", "lossrecovdist.term",
+clusterExport(cl, list("root.dir", "shockprob", "issuerweights", "rho", "Z", "lossrecovdist.term",
"lossrecovdist", "lossdistC", "Ngrid",
"tranche.pvvec", "tranche.pv", "tranche.pl", "tranche.cl",
"trancheloss", "trancherecov", "pos", "Kmodified", "cs"))
@@ -152,7 +152,8 @@ for(l in 1:100){
cat(err,"\n")
}
-write.table(data.frame(Z=Z, w=w.mod), file=file.path(root.dir, "Scenarios", paste0("calibration-", Sys.Date(), ".csv")), col.names=T, row.names=F, sep=",")
+write.table(data.frame(Z=Z, w=w.mod), file=file.path(root.dir, "Scenarios", "Calibration", paste0("calibration-", Sys.Date(), ".csv")), col.names=T, row.names=F, sep=",")
+save(singlenames.data, hy19, tranche.upf, file = file.path(root.dir, "Scenarios", "Calibration", paste0("marketdata-", Sys.Date(), ".RData")))
## computes MFdeltas
newportf <- hy19portfolio.tweaked