summaryrefslogtreecommitdiffstats
path: root/R
diff options
context:
space:
mode:
Diffstat (limited to 'R')
-rw-r--r--R/tranche_functions.R6
1 files changed, 5 insertions, 1 deletions
diff --git a/R/tranche_functions.R b/R/tranche_functions.R
index ce39b16..387a899 100644
--- a/R/tranche_functions.R
+++ b/R/tranche_functions.R
@@ -712,7 +712,11 @@ adjust.skew <- function(index1, index2, method="ATM"){
el1 <- EL(index1)
el2 <- EL(index2)
}
- skew <- splinefun(K1, index1$rho[-c(1, length(index1$rho))], "natural")
+ skew <- function(x){
+ #we cap the correlation at 0.99
+ f <- splinefun(K1, index1$rho[-c(1, length(index1$rho))], "natural")
+ return(min(f(x), 0.99))
+ }
if(method=="ATM"){
K1eq <- el1/el2 * K2
}else if(method == "TLP"){