R/propCI-exact.R

Defines functions propCI_exact

propCI_exact <-
function(x, n, l){

  if (x == 0){
    lw <- 0
    up <- 1 - l[3] ^ (1/n)
  } else if (x == n){
    lw <- l[3] ^ (1/n)
    up <- 1
  } else{
    lw <- qbeta(l[1], x, n - x + 1, lower.tail = T)
    up <- qbeta(l[2], x + 1, n - x, lower.tail = T)
  }

  return(c(lw, up))
}

Try the prevalence package in your browser

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

prevalence documentation built on June 4, 2022, 1:05 a.m.