diff options
| -rw-r--r-- | R/tranche_functions.R | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/R/tranche_functions.R b/R/tranche_functions.R index 243a222c..087f5d75 100644 --- a/R/tranche_functions.R +++ b/R/tranche_functions.R @@ -538,9 +538,9 @@ funded.tranche.pv <- function(L, R, cs, K1, K2, scaled = FALSE){ }else{
size <- K2 - K1 -trancheloss(L, K1, K2) - trancherecov(R, K1, K2)
sizeadj <- as.numeric(0.5 * (size + c(K2-K1, size[-length(size)])))
- interest <- 1/(K2-K1) * crossprod(sizeadj * cs$coupons, cs$df)
- principal <- trancherecov(R, K1, K2)
- principal[length(principal)] <- size[length(size)]
+ interest <- crossprod(sizeadj * cs$coupons, cs$df)
+ principal <- diff(c(0, trancherecov(R, K1, K2)))
+ principal[length(principal)] <- principal[length(principal)] + size[length(size)]
principal <- crossprod(cs$df, principal)
if(scaled){
pv <- (interest + principal)/(K2-K1)
|
