diff options
Diffstat (limited to 'plot_distributions.R')
| -rw-r--r-- | plot_distributions.R | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/plot_distributions.R b/plot_distributions.R index 840a9ea0..0b369065 100644 --- a/plot_distributions.R +++ b/plot_distributions.R @@ -1,14 +1,14 @@ ## some plots
matplot(Z, cbind(w, w.mod), type="l", ylab="probability density",
main="Factor distribution (Gaussian, and Market implied)")
-lossdist <- array(0, dim=c(1/lu+1, n.int))
+lossdist <- array(0, dim=c(Ngrid, n.int))
for(i in 1:n.int){
pshocked <- sapply(p[,ncol(p)], shockprob, rho=rho, Z=Z[i])
S <- 1 - Rstoch[i,,ncol(p)]
- lossdist[,i] <- lossrecovdist(pshocked, 0, issuerweights, S, lu)$L
+ lossdist[,i] <- lossrecovdist(pshocked, 0, issuerweights, S, Ngrid)$L
}
-lossdist.orig <- BClossdistC(SurvProb, issuerweights, recov, rho, lu)
+lossdist.orig <- BClossdistC(SurvProb, issuerweights, recov, rho, Ngrid)
matplot(seq(0,1,0.01), cbind(lossdist.orig$L[,ncol(p)], lossdist%*%w.mod), type="l", xlab="loss percentage",
ylab="probability density", main="market implied loss distribution")
#3d surface of the loss distribution
@@ -18,7 +18,7 @@ for(t in 1:ncol(SurvProb)){ Rstoch[t,,i] <- stochasticrecov(recov[i], 0, Z, w.mod, rho, defaultprob[i,t], p[i,t])
}
}
-lu <- 0.01
+
clusterExport(cl, list("p", "shockprob", "rho", "Z", "lossdistribC.joint", "Rstoch", "lu"))
parf <- function(i){
|
