aboutsummaryrefslogtreecommitdiffstats
path: root/build_SC.R
diff options
context:
space:
mode:
Diffstat (limited to 'build_SC.R')
-rw-r--r--build_SC.R15
1 files changed, 2 insertions, 13 deletions
diff --git a/build_SC.R b/build_SC.R
index 5e478d93..5054f863 100644
--- a/build_SC.R
+++ b/build_SC.R
@@ -140,20 +140,9 @@ dist.joint <- MFlossdist.prepay.joint(cl, w.mod, Z, rho, dp, dpmod,
## first using the actual function (numerically instable)
## dist.joint2 <- MFlossdist.prepay.joint(cl, w.mod, Z, rho, dp, dpmod,
## pp, ppmod, issuerweights, 1-S, Ngrid=201, TRUE)
+
## second, by doing a change of variable seems to work better for now
-distDR <- array(0, dim=dim(dist.joint))
-u <- seq(0, 1, length=Ngrid)
-v <- seq(0, 1, length=Ngrid)
-for(t in 1:ncol(dp)){
- for(i in 1:Ngrid){
- for(j in 1:Ngrid){
- index <- i+j
- if(index<=Ngrid){
- distDR[t,index,j] <- distDR[t,index,j] + dist.joint[t,i,j]
- }
- }
- }
-}
+distDR <- dist.transform(dist.joint)
## compute E(R|D)
R <- matrix(0, Ngrid, ncol(dp))