diff options
Diffstat (limited to 'R')
| -rw-r--r-- | R/tranche_functions.R | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/R/tranche_functions.R b/R/tranche_functions.R index d071fda..ce08288 100644 --- a/R/tranche_functions.R +++ b/R/tranche_functions.R @@ -747,13 +747,17 @@ BCtranche.delta <- function(index, Z, w, N=length(index$portolio)+1, tradedate = return( list(deltas=deltas, gammas=gammas) )
}
-EL <- function(index){
- ## computes the expected loss of a portfolio (time discounted)
+EL <- function(index, discounted=TRUE){
+ ## computes the expected loss of a portfolio (time discounted if discounted is TRUE)
## given the default curves and recovery
## should be very close to the protection leg of the portfolio of cds
## index should be a list with issuerweights, recov, defaultprob and cs parameters
ELvec <- as.numeric(crossprod(index$issuerweights * (1-index$recov), index$defaultprob))
- return( sum(index$cs$df*diff(c(0, ELvec))) )
+ if(!discounted){
+ return( diff(c(0, ELvec)) )
+ }else{
+ return( sum(index$cs$df*diff(c(0, ELvec))) )
+ }
}
ELtrunc <- function(index, K, rho, Z, w, Ngrid){
|
