summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--R/distrib.R11
1 files changed, 8 insertions, 3 deletions
diff --git a/R/distrib.R b/R/distrib.R
index c6dc609..eeb1796 100644
--- a/R/distrib.R
+++ b/R/distrib.R
@@ -281,7 +281,11 @@ lossdistC <- function(p, w, S, N, defaultflag=FALSE){
}
lossdistCZ <- function(p, w, S, N, defaultflag=FALSE, rho, Z){
- #S is of size (length(p), length(Z))
+ ##S is of size (length(p), length(Z))
+ stopifnot(length(rho)==length(p),
+ length(rho)==length(w),
+ nrow(S)==length(p),
+ ncol(S)==length(Z))
.C("lossdistrib_Z", as.double(p), as.integer(length(p)),
as.double(w), as.double(S), as.integer(N), as.logical(defaultflag),
as.double(rho), as.double(Z), as.integer(length(Z)),
@@ -553,11 +557,12 @@ BClossdist <- function(defaultprob, issuerweights, recov, rho, Z, w,
BClossdistC <- function(defaultprob, issuerweights, recov, rho, Z, w,
N=length(issuerweights)+1, defaultflag=FALSE){
- stopifnot(length(Z)==length(w),
- nrow(defaultprob)==length(issuerweights))
if(is.null(dim(defaultprob))){
dim(defaultprob) <- c(length(defaultprob),1)
}
+ stopifnot(length(Z)==length(w),
+ nrow(defaultprob)==length(issuerweights),
+ nrow(defaultprob)==length(recov))
L <- matrix(0, N, ncol(defaultprob))
R <- matrix(0, N, ncol(defaultprob))
rho <- rep(rho, length(issuerweights))