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.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5f65bfa647c993319f596141e76fde655efb100a8af0c6d06f587ce41aa9bab |
|
MD5 | a0db124d93fb94697763414a47296743 |
|
BLAKE2b-256 | 5578c18ad07c3113dca1b15c6d3ff70f2267efc8a2b301f9a1b2cc52e4cd7d0a |
Hashes for python_probabilities-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5a47a414f6611a996d15e109292977af630c2fd205f382a4f9cd6b1d74136d7 |
|
MD5 | ef426a61a0a757d551df2d74d16aa074 |
|
BLAKE2b-256 | 5ee1434276412563215fa45bd63efff55c0e42e9f2dc4298059edb66d2d13a20 |