R/truncatedPbg.R

truncatedPbg <-
function (p, trunc = 0.2)
    {
        stopifnot((trunc>0)&(trunc<=1))
        stopifnot(is.vector(p))
        stopifnot((min(p)>=0)&(max(p)<=1))
        w <- prod(p^(p<=trunc))
        L <- length(p)
        if (w > trunc) {
            1
        }
        else {
            mix <- stats::dbinom(1:L,L,trunc)
            prob <- 1 - stats::pgamma(-log(w/(trunc^(1:L))),1:L)
            sum(mix*prob)
        }
}

Try the sensitivitymv package in your browser

Any scripts or data that you put into this service are public.

sensitivitymv documentation built on May 2, 2019, 2:06 a.m.