R/CP.upper.R

#' @export

CP.upper <-
function (x, n, a = 0.05)
{
    #       FUNCTION COMPUTES EXACT CONFIDENCE INTERVAL FOR
    #       BINOMIAL PROBABILITY BY INVERSION OF THE EXACT TEST.
    #
    #       REQUIRED ARGUMENTS:
    #       x - observed value (scalar)
    #       n - number of trials
    #
    if (x > 0 & x < n) {upper <- stats::qbeta(1-a,x+1,n-x)}
    if (x == 0) {upper <- 1 - a^(1/n)}
    if (x == n) {upper <- 1}
    upper
}

Try the CLAST package in your browser

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

CLAST documentation built on April 8, 2022, 9:06 a.m.