summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@serenitascapital.com>2014-08-15 11:06:01 -0400
committerGuillaume Horel <guillaume.horel@serenitascapital.com>2014-08-15 11:06:01 -0400
commit1c0ecf83962dea62b1222c1b419d08fb969e322a (patch)
treeb4cabbd784e7fcf2625657ff481a7548c70423bb
parenta4c9aa862fbf2891cb8abfae2ac7ef9558ae207b (diff)
downloadlossdistrib-1c0ecf83962dea62b1222c1b419d08fb969e322a.tar.gz
check for inverted skew
-rw-r--r--R/tranche_functions.R7
1 files changed, 6 insertions, 1 deletions
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]