summaryrefslogtreecommitdiffstats
path: root/R/tranche_functions.R
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@serenitascapital.com>2014-05-07 15:31:07 -0400
committerGuillaume Horel <guillaume.horel@serenitascapital.com>2014-05-07 15:31:07 -0400
commit050e936cbf24c9c89d719522f93162c476f87663 (patch)
tree41b6d5da13dda6d60153d95223e6404e857dac7b /R/tranche_functions.R
parent6eac91bf7bcf3515e661d74b49e8179938bd1488 (diff)
downloadlossdistrib-050e936cbf24c9c89d719522f93162c476f87663.tar.gz
update BCstrikes to make sure it works
Diffstat (limited to 'R/tranche_functions.R')
-rw-r--r--R/tranche_functions.R7
1 files changed, 4 insertions, 3 deletions
diff --git a/R/tranche_functions.R b/R/tranche_functions.R
index 5fa954a..b575c33 100644
--- a/R/tranche_functions.R
+++ b/R/tranche_functions.R
@@ -718,13 +718,14 @@ BCtranche.delta <- function(portfolio, index, coupon, K1, K2, rho1, rho2, Z, w,
return( delta )
}
-BCstrikes <- function(portfolio, index, coupon, K, rho, N=101) {
+BCstrikes <- function(defaultprob, issuerweights, recov, cs, Kmodified, rho, Z, w, N=101) {
## computes the strikes as a percentage of expected loss
+ ## Kmodified is the current attachment points (adjusted for losses)
EL <- c()
for(i in 2:length(K)){
- EL <- c(EL, -BCtranche.pv(portfolio, index, coupon, K[i-1], K[i], rho[i-1], rho[i], N)$pl)
+ EL <- c(EL, -BCtranche.pv(defaultprob, issuerweights, recov, cs,
+ K[i-1], K[i], rho[i-1], rho[i], Z, w, N)$pl)
}
- Kmodified <- adjust.attachments(K, index$loss, index$factor)
return(cumsum(EL*diff(Kmodified))/sum(EL*diff(Kmodified)))
}