Skip to content

egusahiroaki/binomial-proportion

Repository files navigation

binomial-proportion

Build Status Coverage Status MIT License

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

install

npm install binomial-proportion

Usage

const 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);

  • observed Number of observed positive outcomes.
  • sample Size of sample.
  • significance level The probability of rejecting the null hypothesis when it is true
  • method "normal", "agresti_coull", "wilson"