Simple JavaScript implementation of Binomial Proportion Confidence Interval. You can use three types of their methods.
- Normal approximation interval (also known as Wald)
- Wilson score interval
- Agresti–Coull interval
For the detail of formula, please see the Wikipedia page on Binomial proportion confidence interval
npm install binomial-proportionconst BinomialProportion = require("binomial-proportion");
const result = BinomialProportion(50, 500, 0.05, "normal");
/*
{
lowerBound: 0.07370432378270254,
value: 0.1,
upperBound: 0.12629567621729745
}
*/BinomialProportion(observed, sample, significance level, method);
observedNumber of observed positive outcomes.sampleSize of sample.significance levelThe probability of rejecting the null hypothesis when it is truemethod"normal", "agresti_coull", "wilson"