Giter VIP home page Giter VIP logo

poibin's Introduction

Poisson Binomial Distribution for Python

About

The module contains a Python implementation of functions related to the Poisson Binomial probability distribution [1], which describes the probability distribution of the sum of independent Bernoulli random variables with non-uniform success probabilities. For further information, see reference [1].

The implemented methods are:

  • pmf: probability mass function
  • cdf: cumulative distribution function
  • pval: p-value for right tailed tests

Author

Mika Straka

This Version

The newest version can be found on https://github.com/tsakim/poibin

Dependencies

Usage

Consider n independent and non-identically distributed random variables and be p a list/NumPy array of the corresponding Bernoulli success probabilities. In order to create the Poisson Binomial distributions, use

from poibin import PoiBin
pb = PoiBin(p)

Be x a list/NumPy array of different numbers of success. Use the following methods to obtain the corresponding quantities:

  • Probability mass function
pb.pmf(x)
  • Cumulative distribution function
pb.cdf(x)
  • P-values for right tailed tests
pb.pval(x)

All three methods accept single integers as well as lists/NumPy arrays of integers. Note that x[i] must be smaller than len(p).

Testing

The methods have been implemented using the pytest module. To run the tests, execute

$ pytest test_poibin.py

in the command line. For verbose mode, use

$ pytest -v test_poibin.py

Reference

Yili Hong, On computing the distribution function for the Poisson binomial distribution, Computational Statistics & Data Analysis, Volume 59, March 2013, pages 41-51, ISSN 0167-9473


Copyright (c) 2016-2017 Mika J. Straka

poibin's People

Contributors

tsakim avatar davoudtaghawinejad avatar brooksandrew avatar

Watchers

James Cloos avatar

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.