diff options
Diffstat (limited to 'R/tranche_functions.R')
| -rw-r--r-- | R/tranche_functions.R | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/R/tranche_functions.R b/R/tranche_functions.R index 482d6237..4650c19b 100644 --- a/R/tranche_functions.R +++ b/R/tranche_functions.R @@ -280,6 +280,14 @@ lossdistC.prepay.joint <- function(dp, pp, w, S, N, defaultflag=FALSE){ }
lossdistC.prepay.jointZ <- function(dp, pp, w, S, N, defaultflag = FALSE, rho, Z, wZ){
+ ## N is the size of the grid
+ ## dp is of size n.credits
+ ## pp is of size n.credits
+ ## w is of size n.credits
+ ## S is of size n.credits by nZ
+ ## rho is a double
+ ## Z is a vector of length nZ
+ ## w is a vector if length wZ
if(!is.loaded("lossdistrib_prepay_joint_Z")){
dyn.load(file.path(root.dir, "code", "R", paste0("lossdistrib", .Platform$dynlib.ext)))
}
@@ -842,10 +850,12 @@ MFlossdist.prepay.joint2 <- function(w, Z, rho, defaultprob, defaultprobmod, Rstoch[i,,t] <- stochasticrecovC(recov[i], 0, Z, w, rho, defaultprob[i,t], defaultprobmod[i,t])
}
}
+
Q <- array(0, dim=c(ncol(defaultprob), Ngrid, Ngrid))
for(t in 1:ncol(defaultprob)){
S <- 1 - Rstoch[,,t]
- Q[t,,] <- lossdistC.prepay.jointZ(dp[,t], pp[,t], issuerweights, S, Ngrid, defaultflag, rho, Z, w)
+ Q[t,,] <- lossdistC.prepay.jointZ(defaultprobmod[,t], prepayprobmod[,t], issuerweights,
+ S, Ngrid, defaultflag, rho, Z, w)
}
return( Q )
}
|
