From 1c0ecf83962dea62b1222c1b419d08fb969e322a Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Fri, 15 Aug 2014 11:06:01 -0400 Subject: check for inverted skew --- R/tranche_functions.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/tranche_functions.R b/R/tranche_functions.R index c9b1ee1..83e7199 100644 --- a/R/tranche_functions.R +++ b/R/tranche_functions.R @@ -707,7 +707,12 @@ theta.adjust.skew <- function(index, shortened=4){ BCtranche.theta <- function(index, tradedate=Sys.Date(), shortened=4){ temp <- BCtranche.pv(index) - index$rho <- theta.adjust.skew(index, shortened) + rho.adj <- theta.adjust.skew(index, shortened) + if(any(rho.adj[-c(1, length(rho.adj))]<=0)){ + print("probable inverted skew: no adjustment") + }else{ + index$rho <- rho.adj + } N <- nrow(index$cs)-shortened index$cs <- index$cs[1:N,] index$defaultprob <- index$defaultprob[,1:N] -- cgit v1.2.3-70-g09d2