diff options
| author | Guillaume Horel <guillaume.horel@serenitascapital.com> | 2014-09-05 10:40:28 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@serenitascapital.com> | 2014-09-05 10:40:28 -0400 |
| commit | 92c0f4f2f537ce167325b7c8d2713a7633cd0770 (patch) | |
| tree | 85b408a960933e972e894ff7a75619627dea8249 /R/tranche_functions.R | |
| parent | 7b3e8c8bc8e045601900d88bc962e1f91d1e4083 (diff) | |
| download | lossdistrib-92c0f4f2f537ce167325b7c8d2713a7633cd0770.tar.gz | |
update due to new organisation of index object
Diffstat (limited to 'R/tranche_functions.R')
| -rw-r--r-- | R/tranche_functions.R | 8 |
1 files 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){
|
