Poibin
Poisson Binomial Probability Distribution for Python
Install / Use
/learn @tsakim/PoibinREADME
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 functioncdf: cumulative distribution functionpval: 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
Copyright (c) 2016-2017 Mika J. Straka
Related Skills
node-connect
347.6kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.6kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.6kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
