diff options
| author | Guillaume Horel <guillaume.horel@serenitascapital.com> | 2014-07-14 16:04:31 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@serenitascapital.com> | 2014-07-14 16:04:31 -0400 |
| commit | 2643a2d4adeb9a4dcfcbc34ec742085f4f2a8746 (patch) | |
| tree | c601a397e904083689a66f429fdf8f3c405895f0 /R/tranche_functions.R | |
| parent | f01964c779bfe3631bb608b7865ba7608b0ccef2 (diff) | |
| download | lossdistrib-2643a2d4adeb9a4dcfcbc34ec742085f4f2a8746.tar.gz | |
add new corr01 risk function
Diffstat (limited to 'R/tranche_functions.R')
| -rw-r--r-- | R/tranche_functions.R | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/R/tranche_functions.R b/R/tranche_functions.R index 16960e0..8d7958d 100644 --- a/R/tranche_functions.R +++ b/R/tranche_functions.R @@ -740,11 +740,19 @@ BCtranche.delta <- function(index, tradedate = Sys.Date()){ deltas <- (bp[,2]-bp[,3])/(indexbp[2]-indexbp[3])
deltasplus <- (bp[,4]-bp[,1])/(indexbp[4]-indexbp[1])
- gammas <- (deltasplus-deltas)/(indexbp[1]-indexbp[1])/100
+ gammas <- (deltasplus-deltas)/(indexbp[2]-indexbp[1])/100
return( list(deltas=deltas, gammas=gammas) )
}
+BCtranche.corr01 <- function(index, eps=0.01){
+ ##does a parallel shift of the skew and computes the change in pv
+ before <- BCtranche.pv(index)
+ index$rho[-1] <- index$rho[-1]+eps
+ after <- BCtranche.pv(index)
+ return(before$bp-after$bp)
+}
+
EL <- function(index, discounted=TRUE, shortened=0){
## computes the expected loss of a portfolio (time discounted if discounted is TRUE)
## given the default curves and recovery
|
