Library for accurate statistical calculations using Python.
Project description
Python Probabilities 🐍
Library for accurate statistical calculations using Python.
Binomial Distributions
Binomial Probability Distribution
If a random variable X
has the binomial distribution B(n, p)
, then its probability mass function can be calculated via Bpd(r, n, p)
.
(where r
is the number of successes, n
is the number of trials, and p
is the probability of success)
The code below would be to calculate P(X=7)
for the binomial distribution X~B(11, 0.33)
.
>>> from python_probabilities import Bpd
>>> Bpd(7, 11, 0.33)
0.0283407102416171981610
Binomial Cumulative Distribution
For the binomial distribution X~B(n, p)
, the cumulative probability function can be calculated via Bcd(r, n, p)
.
(where r
is the number of successes, n
is the number of trials, and p
is the probability of success)
The code below would be to calculate P(X≤7)
for the binomial distribution X~B(11, 0.33)
.
>>> from python_probabilities import Bcd
>>> Bcd(7, 11, 0.33)
0.9917567634324003237640
"A cumulative probability function for a random variable X tells you the sum of all the individual probabilities up to and including the given value of x in the calculation for P(X < x)".
Inverse Binomial Cumulative Distribution
Given the probability for a cumulative probability function, the value for r
(number of successes) can be calculated via InvB(x, n, p)
.
(where x
is the probability, n
is the number of trials, and p
is the probability of success)
>>> from python_probabilities import *
>>> InvB(0.9917567634, 11, 0.33)
7
>>> Bcd(7, 11, 0.33)
0.9917567634324003237640
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for python_probabilities-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e0525cdeed350df861db290ada09fa4c1d09282af7bb2f642f78c219f545dd7 |
|
MD5 | c03b46e31d15b0cdbf9b3e2d28104b0f |
|
BLAKE2b-256 | c74deb285b6896a25c4142ea573f0fe981a2e5adc0e8f9bfeb062d67ed103b61 |
Hashes for python_probabilities-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bccfc55dc851c9fea363ad82d93b266e518f9aff96340e52b0d02283886eacbe |
|
MD5 | b76e82a75b12ad3fea4d6f2c291fc9cf |
|
BLAKE2b-256 | 07300d64bf780c0c8040605d2ccfa1f0d1f2124b0391d5309003dd34958aeda0 |