aboutsummaryrefslogtreecommitdiffstats
path: root/R/tranche_functions.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/tranche_functions.R')
-rw-r--r--R/tranche_functions.R9
1 files changed, 5 insertions, 4 deletions
diff --git a/R/tranche_functions.R b/R/tranche_functions.R
index 7679b076..b6628ac4 100644
--- a/R/tranche_functions.R
+++ b/R/tranche_functions.R
@@ -325,7 +325,7 @@ MFtranche.delta <- function(index){
BCtranche.corr01 <- function(index, eps=0.01, complement=FALSE){
##does a parallel shift of the skew and computes the change in pv
before <- BCtranche.pv(index, complement=complement)
- index$rho[-1] <- exp(log(index$rho[-1])*(1+eps))
+ index$rho[-1] <- index$rho[-1])*(1+eps)
after <- BCtranche.pv(index, complement=complement)
return(after$bp-before$bp)
}
@@ -333,13 +333,14 @@ BCtranche.corr01 <- function(index, eps=0.01, complement=FALSE){
BCtranche.VaR <- function(index, skew.shocks, complement=FALSE){
before <- BCtranche.pv(index, complement=complement)
n <- length(index$rho)
- r <- matrix(0, nrow(skew.shocks))
- logskew <- log(index$skew[-c(1,n)])
+ r <- matrix(0, nrow(skew.shocks), n-1)
+ logskew <- log(index$rho[-c(1,n)])
for(i in 1:nrow(skew.shocks)){
index$rho[-c(1,n)] <- exp(logskew*(1+skew.shocks[i,]))
after <- BCtranche.pv(index, complement=complement)
- r[i,] <- before-after
+ r[i,] <- before$bp-after$bp
}
+ return( r )
}
EL <- function(index, discounted=TRUE, shortened=0){