aboutsummaryrefslogtreecommitdiffstats
path: root/R/load_cf.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/load_cf.R')
-rw-r--r--R/load_cf.R4
1 files changed, 2 insertions, 2 deletions
diff --git a/R/load_cf.R b/R/load_cf.R
index a6810e0d..0fef5ac2 100644
--- a/R/load_cf.R
+++ b/R/load_cf.R
@@ -255,10 +255,9 @@ getcusipcf <- function(cusips, cfdata, dist, workdate=Sys.Date()){
}
compute.delta <- function(indexdist, dealweight, cusip.pv, workdate=Sys.Date()){
- indexpv <- c()
calibration.date <- prevBusDay(workdate)
cs <- couponSchedule(nextIMMDate(workdate), as.Date("2017-12-20"), "Q",
- "FLOAT", 0, 0.05, calibration.date)
+ "FIXED", 0.05, 0, calibration.date)
nT <- dim(indexdist$L)[2]
Ngrid <- dim(indexdist$L)[1]
scenariosl <- matrix(0, length(dealweight), nT)
@@ -272,6 +271,7 @@ compute.delta <- function(indexdist, dealweight, cusip.pv, workdate=Sys.Date()){
for(i in 1:length(dealweight)){
indexpv <- c(indexpv, funded.tranche.pv(scenariosl[i,], scenariosr[i,], cs, 0, 1))
}
+
model <- lm(cusip.pv~indexpv, weights=dealweight)
return(model$coef[2])
}