diff options
| author | Guillaume Horel <guillaume.horel@serenitascapital.com> | 2014-08-14 10:57:49 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@serenitascapital.com> | 2014-08-14 10:57:49 -0400 |
| commit | a4c9aa862fbf2891cb8abfae2ac7ef9558ae207b (patch) | |
| tree | 692b5d94033817c885771db64242d3ef185369dc /R | |
| parent | 3d1c418a183371bcb663153f8b53f2a5ac5ce6b5 (diff) | |
| download | lossdistrib-a4c9aa862fbf2891cb8abfae2ac7ef9558ae207b.tar.gz | |
new adjust.skew function for different index mapping
Diffstat (limited to 'R')
| -rw-r--r-- | R/tranche_functions.R | 12 |
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)
|
