diff options
Diffstat (limited to 'R/distrib.R')
| -rw-r--r-- | R/distrib.R | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/R/distrib.R b/R/distrib.R index f8d1c00..59fba37 100644 --- a/R/distrib.R +++ b/R/distrib.R @@ -26,7 +26,7 @@ GHquad <- function(n){ n <- as.integer(n) Z <- double(n) w <- double(n) - result <- .C("C_GHquad", n, Z=Z, w=w) + result <- .C(C_GHquad, n, Z=Z, w=w) result[[1]] <- NULL return(result) } @@ -316,7 +316,7 @@ lossdist.prepay.joint <- function(dp, pp, w, S, N, defaultflag=FALSE){ lossdistC <- function(p, w, S, N, defaultflag=FALSE){ ## C version of lossdistrib2, roughly 50 times faster - .C("C_lossdistrib", as.double(p), as.integer(length(p)), + .C(C_lossdistrib, as.double(p), as.integer(length(p)), as.double(w), as.double(S), as.integer(N), as.integer(N), as.logical(defaultflag), q = double(N))$q } @@ -327,7 +327,7 @@ lossdistCZ <- function(p, w, S, N, defaultflag=FALSE, rho, Z){ length(rho) == length(w), nrow(S) == length(p), ncol(S) == length(Z)) - .C("C_lossdistrib_Z", as.double(p), as.integer(length(p)), as.double(w), + .C(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)), q = matrix(0, N, length(Z)))$q } @@ -335,7 +335,7 @@ lossdistCZ <- function(p, w, S, N, defaultflag=FALSE, rho, Z){ lossdistC.truncated <- function(p, w, S, N, T=N, defaultflag=FALSE){ ## truncated version of lossdistrib ## q[i] is 0 for i>=T - .C("C_lossdistrib", as.double(p), as.integer(length(p)), + .C(C_lossdistrib, as.double(p), as.integer(length(p)), as.double(w), as.double(S), as.integer(N), as.integer(T), as.logical(defaultflag), q = double(N))$q } @@ -343,7 +343,7 @@ lossdistC.truncated <- function(p, w, S, N, T=N, defaultflag=FALSE){ exp.trunc <- function(p, w, S, N, K){ ## computes E[(K-L)^+] r <- 0 - .C("C_exp_trunc", as.double(p), as.integer(length(p)), + .C(C_exp_trunc, as.double(p), as.integer(length(p)), as.double(w), as.double(S), as.integer(N), as.double(K), res = r)$res } @@ -360,13 +360,13 @@ rec.trunc <- function(p, w, S, N, K){ recovdistC <- function(dp, pp, w, S, N){ ## C version of recovdist - .C("C_recovdist", as.double(dp), as.double(pp), as.integer(length(dp)), + .C(C_recovdist, as.double(dp), as.double(pp), as.integer(length(dp)), as.double(w), as.double(S), as.integer(N), q = double(N))$q } lossdistC.prepay.joint <- function(dp, pp, w, S, N, defaultflag=FALSE){ ## C version of lossdist.prepay.joint - r <- .C("C_lossdistrib_joint", as.double(dp), as.double(pp), as.integer(length(dp)), + r <- .C(C_lossdistrib_joint, as.double(dp), as.double(pp), as.integer(length(dp)), as.double(w), as.double(S), as.integer(N), as.logical(defaultflag), q=matrix(0, N, N))$q return(r) } @@ -381,7 +381,7 @@ lossdistC.prepay.jointZ <- function(dp, pp, w, S, N, defaultflag = FALSE, rho, Z ## Z is a vector of length nZ ## w is a vector if length wZ - r <- .C("C_lossdistrib_joint_Z", as.double(dp), as.double(pp), as.integer(length(dp)), + r <- .C(C_lossdistrib_joint_Z, as.double(dp), as.double(pp), as.integer(length(dp)), as.double(w), as.double(S), as.integer(N), as.logical(defaultflag), as.double(rho), as.double(Z), as.double(wZ), as.integer(length(Z)), output = matrix(0,N,N)) return(r$output) @@ -521,7 +521,7 @@ fit.prob <- function(Z, w, rho, p0){ fit.probC <- function(Z, w, rho, p0){ stopifnot(length(Z)==length(w)) - r <- .C("C_fitprob", as.double(Z), as.double(w), as.integer(length(Z)), + r <- .C(C_fitprob, as.double(Z), as.double(w), as.integer(length(Z)), as.double(rho), as.double(p0), q = double(1)) return(r$q) } @@ -538,7 +538,7 @@ stochasticrecov <- function(R, Rtilde, Z, w, rho, porig, pmod){ } stochasticrecovC <- function(R, Rtilde, Z, w, rho, porig, pmod){ - r <- .C("C_stochasticrecov", as.double(R), as.double(Rtilde), as.double(Z), + r <- .C(C_stochasticrecov, as.double(R), as.double(Rtilde), as.double(Z), as.double(w), as.integer(length(Z)), as.double(rho), as.double(porig), as.double(pmod), q = double(length(Z))) return(r$q) @@ -586,7 +586,7 @@ BClossdistC <- function(defaultprob, issuerweights, recov, rho, Z, w, L <- matrix(0, N, ncol(defaultprob)) R <- matrix(0, N, ncol(defaultprob)) rho <- rep(rho, length(issuerweights)) - r <- .C("C_BCloss_recov_dist", defaultprob, as.integer(nrow(defaultprob)), + r <- .C(C_BCloss_recov_dist, defaultprob, as.integer(nrow(defaultprob)), as.integer(ncol(defaultprob)), as.double(issuerweights), as.double(recov), as.double(Z), as.double(w), as.integer(length(Z)), as.double(rho), as.integer(N), as.logical(defaultflag), L=L, R=R) @@ -601,7 +601,7 @@ BCER <- function(defaultprob, issuerweights, recov, K, rho, Z, w, rho <- rep(rho, length(issuerweights)) ELt <- numeric(ncol(defaultprob)) ERt <- numeric(ncol(defaultprob)) - r <- .C("C_BCloss_recov_trunc", defaultprob, as.integer(nrow(defaultprob)), + r <- .C(C_BCloss_recov_trunc, defaultprob, as.integer(nrow(defaultprob)), as.integer(ncol(defaultprob)), as.double(issuerweights), as.double(recov), as.double(Z), as.double(w), as.integer(length(Z)), as.double(rho), as.integer(N), as.double(K), |
