Giter Site home page Giter Site logo

binomjs's Introduction

binomjs CI Status

A binomial distribution testing library in JavaScript.

Installation

  • As a Node.js module
npm install binomjs
  • As a component
component install thii/binomjs

Building component

  • Prerequisites: In order to build a minified version you need to have uglify-js installed globally.
npm install uglify-js -g
  • Building
component install
component build -n binom
uglifyjs build/binom.js -o build/binom.min.js

The built version of binomjs will be put in the build/ subdirectory.

Example

var Binom = require('binomjs');
var binom = new Binom();

// binom.test(trialsNum, successesNum, hypothesisTrialsNum, hypothesisSuccessesNum, confidenceRate)
var result = binom.test(1000, 100, 1000, 50, 0.95);
/*
{ averageSuccessRate: 0.1,
  minSuccessRate: 0.0814,
  maxSuccessRate: 0.1186,
  pValue: 0.024997895303140116,
  testResult: true,
  error: undefined }
*/

The above example run in R:

binom.test(100, 1000, p = 0.95, alternative = c("two.sided"), conf.level = 0.95)

Result in R:

	Exact binomial test

data:  100 and 1000
number of successes = 100, number of trials = 1000, p-value < 2.2e-16
alternative hypothesis: true probability of success is not equal to 0.95
95 percent confidence interval:
 0.08210533 0.12028794
sample estimates:
probability of success 
                   0.1 

Running Tests

npm install
npm test

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.