summaryrefslogtreecommitdiffstats
path: root/R
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@serenitascapital.com>2016-03-08 17:27:30 -0500
committerGuillaume Horel <guillaume.horel@serenitascapital.com>2016-03-08 17:27:30 -0500
commit5496aac5be711883d4ef92828d4031762cb62b16 (patch)
tree8a785abc59b72bc9d207176531677ce782157bb9 /R
parent34d782603539bb2fa6035abc664f16edb89df536 (diff)
downloadlossdistrib-5496aac5be711883d4ef92828d4031762cb62b16.tar.gz
small fixes
Diffstat (limited to 'R')
-rw-r--r--R/distrib.R9
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))