diff options
| author | Guillaume Horel <guillaume.horel@serenitascapital.com> | 2014-08-18 15:41:17 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@serenitascapital.com> | 2014-08-18 15:41:17 -0400 |
| commit | 2e214d0b95271772f084e5b6dd7044f02deb1a8a (patch) | |
| tree | b26c1984be0617a2fbbe6fd03d9b87a195d7ec75 /R/tranche_functions.R | |
| parent | c258ce56b223e8a0138a672b1be1cee22c468779 (diff) | |
| download | lossdistrib-2e214d0b95271772f084e5b6dd7044f02deb1a8a.tar.gz | |
cap the correlation to 0.99
Diffstat (limited to 'R/tranche_functions.R')
| -rw-r--r-- | R/tranche_functions.R | 6 |
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"){
|
