diff options
| -rw-r--r-- | R/distrib.R | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/R/distrib.R b/R/distrib.R index eeb1796..6c588ff 100644 --- a/R/distrib.R +++ b/R/distrib.R @@ -16,7 +16,7 @@ #' Gaussian distribution.
#'
#' if f is a function, then with(GHquad(100), crossprod(f(Z), w))
-#' will compute \eqn{\frac{1}{\sqrt{2\pi}}\int_-\infty^\infty f(x)e^{-\frac{x^2}{2}}\,dx}.
+#' will compute \eqn{\frac{1}{\sqrt{2\pi}}\int_{-\infty}^\infty f(x)e^{-\frac{x^2}{2}}\,dx}.
#' @param n Integer, the number of nodes
#' @return A list with two components:
#' \item{Z}{the list of nodes}
@@ -477,13 +477,12 @@ dqnorm <- function(x){ fit.prob <- function(Z, w, rho, p0){
## if the weights are not perfectly gaussian, find the probability p such
## E_w(shockprob(p, rho, Z)) = p0
- require(distr)
if(p0==0){
return(0)
}
if(rho == 1){
- distw <- DiscreteDistribution(Z, w)
- return(pnorm(q(distw)(p0)))
+ distw <- distr::DiscreteDistribution(Z, w)
+ return(distr::pnorm(distr::q(distw)(p0)))
}
eps <- 1e-12
dp <- (crossprod(shockprob(p0,rho,Z),w)-p0)/crossprod(dshockprob(p0,rho,Z),w)
@@ -574,7 +573,7 @@ BClossdistC <- function(defaultprob, issuerweights, recov, rho, Z, w, }
BCER <- function(defaultprob, issuerweights, recov, K, rho, Z, w,
- N=length(issuwerweights)+1, defaultflag=FALSE){
+ N=length(issuerweights)+1, defaultflag=FALSE){
stopifnot(length(Z)==length(w),
nrow(defaultprob)==length(issuerweights))
|
