Calculate confidence interval for the mean of binomial probabilities using pooled variance
Source:R/binomial-ci.R
BinomCIMeanPoolNorm.Rd
This method estimates confidence intervals for each unique experiment using the normal approximation. This is suitable for when the number of trials in each experiment is large enough such that Central Limit Theorem holds (i.e. 30+ trials per experiment). It does not necessarily rely on many repetitions of each experiment because the final mean binomial probability is calculated using the t-distribution and number of degrees of freedom corresponding to the effective sample size. The effective sample size is used to calculate a standard error from the pooled variance across experiments and construct the final confidence interval.
Arguments
- x
matrix or numeric. First column of the matrix, or the numeric vector, should represent the estimated binomial proportion for each experiment.
- n
integer. Number of trials per experiment. If
length(n)
does not match the number of estimated binomial proportions it is repeated.- alpha
numeric. Probability level for Z-value in normal distribution confidence interval calculation.
Examples
library(DescTools)
# example: 3 binomial experiments, 10 trials, confidence level 0.8
x <- DescTools::BinomCI(c(5,6,7), 10, 0.8)
# Inspect input
x
#> est lwr.ci upr.ci
#> x.1 0.5 0.3122044 0.6877956
#> x.2 0.6 0.4013518 0.7704344
#> x.3 0.7 0.4973717 0.8462008
BinomCIMeanPoolNorm(x, 10)
#> est lwr.ci upr.ci
#> [1,] 0.6 0.3788071 0.8211929
# Compare to arithmetic average
colMeans(x)
#> est lwr.ci upr.ci
#> 0.6000000 0.4036427 0.7681436