binom.lrt: Binomial confidence intervals using the lrt likelihood

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/binom.lrt.R

Description

Uses the lrt likelihood on the observed proportion to construct confidence intervals.

Usage

1
2
binom.lrt(x, n, conf.level = 0.95, bayes = FALSE, conf.adj = FALSE, plot
= FALSE, ...)

Arguments

x

Vector of number of successes in the binomial experiment.

n

Vector of number of independent trials in the binomial experiment.

conf.level

The level of confidence to be used in the confidence interval.

bayes

logical; if TRUE use a Bayesian correction at the edges. Specfically, a beta prior with shape parameters 0.5 is used. If bayes is numeric, it is assumed to be the parameters to beta distribution.

conf.adj

logical; if TRUE 0 or 100% successes return a one-sided confidence interval

plot

logical; if TRUE a plot showing the the square root of the binomial deviance with reference lines for mean, lower, and upper bounds. This argument can also be a list of plotting parameters to be passed to xyplot.

...

ignored

Details

Confidence intervals are based on profiling the binomial deviance in the neighbourhood of the MLE. If x == 0 or x == n and bayes is TRUE, then a Bayesian adjustment is made to move the log-likelihood function away from Inf. Specifically, these values are replaced by (x + 0.5)/(n + 1), which is the posterier mode of f(p|x) using Jeffrey's prior on p. Furthermore, if conf.adj is TRUE, then the upper (or lower) bound uses a 1 - alpha confidence level. Typically, the observed mean will not be inside the estimated confidence interval. If bayes is FALSE, then the Clopper-Pearson exact method is used on the endpoints. This tends to make confidence intervals at the end too conservative, though the observed mean is guaranteed to be within the estimated confidence limits.

Value

A data.frame containing the observed proportions and the lower and upper bounds of the confidence interval.

Author(s)

Sundar Dorai-Raj (sdorairaj@gmail.com)

See Also

binom.confint, binom.bayes, binom.cloglog, binom.logit, binom.probit, binom.coverage, confint in package MASS, family, glm

Examples

1
binom.lrt(x = 0:10, n = 10)

Example output

   method  x  n mean       lower     upper
1     lrt  0 10  0.0 0.000000000 0.1747534
2     lrt  1 10  0.1 0.005994856 0.3716367
3     lrt  2 10  0.2 0.036365443 0.4994445
4     lrt  3 10  0.3 0.084585447 0.6065389
5     lrt  4 10  0.4 0.145642461 0.7000216
6     lrt  5 10  0.5 0.217621235 0.7823788
7     lrt  6 10  0.6 0.299978368 0.8543575
8     lrt  7 10  0.7 0.393461070 0.9154146
9     lrt  8 10  0.8 0.500555480 0.9636346
10    lrt  9 10  0.9 0.628363321 0.9940051
11    lrt 10 10  1.0 0.825246558 1.0000000

binom documentation built on May 2, 2019, 5:16 p.m.

Related to binom.lrt in binom...