summaryrefslogtreecommitdiffstats
path: root/R
diff options
context:
space:
mode:
Diffstat (limited to 'R')
-rw-r--r--R/tranche_functions.R12
1 files changed, 8 insertions, 4 deletions
diff --git a/R/tranche_functions.R b/R/tranche_functions.R
index 2f55a95..c9b1ee1 100644
--- a/R/tranche_functions.R
+++ b/R/tranche_functions.R
@@ -691,16 +691,20 @@ BCtranche.pv <- function(index, protection=FALSE){
return(list(pl=plvec, cl=clvec, bp=bp))
}
-theta.adjust.skew <- function(index, shortened=4){
- #ajust the correlation skew by doing ATM mapping on the expected loss
+adjust.skew <- function(index, el1){
el <- EL(index)
- elshort <- EL(index, shortened=shortened)
K <- index$K[-c(1,length(index$K))]
rhofun <- splinefun(K, index$rho[-c(1, length(index$rho))], "natural")
- K <- el/elshort*K
+ K <- el/el1*K
return(c(0, rhofun(K), NA))
}
+theta.adjust.skew <- function(index, shortened=4){
+ #ajust the correlation skew by doing ATM mapping on the expected loss
+ elshort <- EL(index, shortened=shortened)
+ return(adjust.skew(index, elshort))
+}
+
BCtranche.theta <- function(index, tradedate=Sys.Date(), shortened=4){
temp <- BCtranche.pv(index)
index$rho <- theta.adjust.skew(index, shortened)