summaryrefslogtreecommitdiffstats
path: root/R
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@serenitascapital.com>2014-09-18 15:02:14 -0400
committerGuillaume Horel <guillaume.horel@serenitascapital.com>2014-09-18 15:02:14 -0400
commitf41e9b225d183dbb7d37cf2e3ae75e902db23251 (patch)
treec7af49d3dcce733533bdb2988868b03d0b612292 /R
parent9d40921fa428330f86814bb813dfb1c524053a40 (diff)
downloadlossdistrib-f41e9b225d183dbb7d37cf2e3ae75e902db23251.tar.gz
complement param was not used and shortened did not work
Diffstat (limited to 'R')
-rw-r--r--R/tranche_functions.R6
1 files changed, 3 insertions, 3 deletions
diff --git a/R/tranche_functions.R b/R/tranche_functions.R
index 217a7b3..97fbc83 100644
--- a/R/tranche_functions.R
+++ b/R/tranche_functions.R
@@ -809,7 +809,7 @@ theta.adjust.skew <- function(index, shortened=4, method="ATM"){
}
BCtranche.theta <- function(index, shortened=4, complement=FALSE, method="ATM"){
- temp <- BCtranche.pv(index, complement=FALSE)
+ temp <- BCtranche.pv(index, complement=complement)
rho.adj <- theta.adjust.skew(index, shortened, method)
if(any(rho.adj[-c(1, length(rho.adj))]<=0)){
print("probable inverted skew: no adjustment")
@@ -920,11 +920,11 @@ BCindex.pv <- function(index, discounted=TRUE, shortened=0){
sizeadj <- 0.5*(c(1, size[-length(size)])+size)
if(!discounted){
pl <- -ELvec[length(ELvec)]
- cl <- as.numeric(crossprod(index$cs$coupons, sizeadj))
+ cl <- as.numeric(crossprod(index$cs$coupons[1:Ncol], sizeadj))
bp <- 1+cl+pl
}else{
pl <- -sum(index$cs$df[1:Ncol]* diff(c(0, ELvec)))
- cl <- as.numeric(crossprod(index$cs$coupons, sizeadj * index$cs$df[1:Ncol] ))
+ cl <- as.numeric(crossprod(index$cs$coupons[1:Ncol], sizeadj * index$cs$df[1:Ncol] ))
bp <- 1+cl+pl
}
bp <- 1+cl*index$quotes$spread+pl