From 92c0f4f2f537ce167325b7c8d2713a7633cd0770 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Fri, 5 Sep 2014 10:40:28 -0400 Subject: update due to new organisation of index object --- R/tranche_functions.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/tranche_functions.R b/R/tranche_functions.R index 135bfe5..ed7fb91 100644 --- a/R/tranche_functions.R +++ b/R/tranche_functions.R @@ -683,7 +683,7 @@ BCtranche.pv <- function(index, protection=FALSE, complement=FALSE){ } dK <- diff(index$K) plvec <- diff(pl)/dK - clvec <- diff(cl)/dK*index$tranche.running + clvec <- diff(cl)/dK*index$tranches$running if(complement){ plvec <- -plvec clvec <- -clvec @@ -706,7 +706,7 @@ MFtranche.pv <- function(index, dist, protection=FALSE){ } dK <- diff(index$K) plvec <- pl/dK - clvec <- cl/dK*index$tranche.running + clvec <- cl/dK*index$tranches$running if(protection){ bp <- -plvec-clvec }else{ @@ -786,7 +786,7 @@ BCtranche.theta <- function(index, shortened=4, complement=FALSE, method="ATM"){ index$defaultprob <- index$defaultprob[,1:N] temp2 <- BCtranche.pv(index, complement=complement) temp3 <- BCtranche.delta(index, complement=complement) - return(list(thetas=temp2$bp-temp$bp+index$tranche.running, + return(list(thetas=temp2$bp-temp$bp+index$tranches$running, forward.deltas=temp3$delta)) } @@ -796,7 +796,7 @@ BCtranche.delta <- function(index, complement=FALSE){ ## if complement is False, then computes deltas bottom-up ## if complement is True, then computes deltas top-down eps <- 1e-4 - index$Ngrid <- 301 ## for gamma computations we need all the precision we can get + index$N <- 301 ## for gamma computations we need all the precision we can get ## we build a lit of 4 indices with various shocks index.list <- lapply(c(0, eps, -eps, 2*eps), function(x){ if(x==0){ -- cgit v1.2.3-70-g09d2