diff options
Diffstat (limited to 'R/tranche_functions.R')
| -rw-r--r-- | R/tranche_functions.R | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/R/tranche_functions.R b/R/tranche_functions.R index 99709832..7a89a570 100644 --- a/R/tranche_functions.R +++ b/R/tranche_functions.R @@ -119,16 +119,16 @@ adjust.attachments <- function(K, losstodate, factor){ BCtranche.legs <- function(index, K, rho, complement=FALSE){ ## computes the protection leg and couponleg of a 0-K tranche ## if complement==TRUE, computes the protection leg and coupon leg of a K-1 tranche - if((K==0 && !complement) || (K==1 && complement)){ + if((K==0 && !complement) || (K==1 && complement)) { return(list(cl=0, pl=0)) - }else if((K==1 && !complement) || (K==0 && complement)){ + }else if((K==1 && !complement) || (K==0 && complement)) { return(BCindex.pv(index)) - }else{ + }else { dist <- BClossdistC(index$defaultprob, index$issuerweights, index$recov, rho, index$Z, index$w, index$N) - if(complement){ + if(complement) { return(list(cl=tranche.cl(dist$L, dist$R, index$cs, K, 1), pl=tranche.pl(dist$L, index$cs, K, 1))) - }else{ + } else { return(list(cl=tranche.cl(dist$L, dist$R, index$cs, 0, K), pl=tranche.pl(dist$L, index$cs, 0, K))) } |
