From f41e9b225d183dbb7d37cf2e3ae75e902db23251 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Thu, 18 Sep 2014 15:02:14 -0400 Subject: complement param was not used and shortened did not work --- R/tranche_functions.R | 6 +++--- 1 file 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 -- cgit v1.2.3-70-g09d2