From 2e214d0b95271772f084e5b6dd7044f02deb1a8a Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Mon, 18 Aug 2014 15:41:17 -0400 Subject: cap the correlation to 0.99 --- R/tranche_functions.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'R/tranche_functions.R') 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"){ -- cgit v1.2.3-70-g09d2