Generalised approximate Bayesian confidence intervals based on a Beta (for binomial rates) or Gamma (for Poisson rates) conjugate priors. Encompassing the Jeffreys method (with Beta(0.5, 0.5) or Gamma(0.5) respectively), as well as any user-specified prior distribution. Clopper-Pearson method (as quantiles of a Beta distribution as described in Brown et al. 2001) also included by way of a "continuity adjustment" parameter.
jeffreysci(
x,
n,
ai = 0.5,
bi = 0.5,
cc = 0,
level = 0.95,
distrib = "bin",
adj = TRUE,
...
)
A list containing the following components:
a matrix containing estimated rate(s), and corresponding approximate Bayesian confidence interval, and the input values x and n.
details of the function call.
Numeric vector of number of events.
Numeric vector of sample sizes (for binomial rates) or exposure times (for Poisson rates).
Numbers defining the Beta prior distribution (default `ai = bi = 0.5`` for Jeffreys interval). Gamma prior for Poisson rates requires only ai.
Number or logical specifying (amount of) "continuity adjustment".
cc = 0 (default) gives Jeffreys interval, cc = 0.5
gives the
Clopper-Pearson interval (or Garwood for Poisson). A value between 0 and
0.5 allows a compromise between proximate and conservative coverage.
Number specifying confidence level (between 0 and 1, default 0.95).
Character string indicating distribution assumed for the input
data:
"bin" = binomial (default);
"poi" = Poisson.
Logical (default TRUE) indicating whether to apply the boundary adjustment recommended on p108 of Brown et al. (set to FALSE if informative priors are used).
Other arguments.
Pete Laud, p.j.laud@sheffield.ac.uk
Laud PJ. Equal-tailed confidence intervals for comparison of rates. Pharmaceutical Statistics 2017; 16:334-348.
Brown LD, Cai TT, DasGupta A. Interval estimation for a binomial proportion. Statistical Science 2001; 16(2):101-133
# Jeffreys method:
jeffreysci(x = 5, n = 56)
Run the code above in your browser using DataLab