You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This approach works well when calculating probabilities below a certain number (e.g., P(X≤7)), but becomes more complicated when trying to calculate a range of values (e.g., P(4≤X≤7)).
In this case, to calculate it using the currently available functions we would have to calculate the following P(X≤7) - P(X≤3).
For example, if we were using a binomial distribution of X ~ B(11, 0.33), we would calculate P(4≤X≤7) like this:
Which gives us an output of 0.5096391069522413707200.
Therefore, I suggest adding an optional lower parameter to the cumulative probability functions, which would default to 0 if not passed into the function. This would make it easier to calculate the probability of a range of values without the need to subtract two probabilities. Additionally, this would increase the efficiency of the algorithm, as it would avoid the need for the functions to iterate twice through the same probabilities.
The text was updated successfully, but these errors were encountered:
Implementing Lower and Upper Bounds for Cumulative Probability Functions #1
Implemented k_upper, and k_lower in binomial and Poisson distributions.
Added test cases for both changed files
Currently, the cumulative probability functions only have the upper bound as a parameter (
k
in both cases), and use0
for the lower bound.https://github.com/berkay-yalin/python-probabilities/blob/c9c9e55a444bec83d71221a26fa5fe181d8c669f/python_probabilities/distributions_binomial.py#L21-L22
https://github.com/berkay-yalin/python-probabilities/blob/c9c9e55a444bec83d71221a26fa5fe181d8c669f/python_probabilities/distributions_poisson.py#L21-L22
This approach works well when calculating probabilities below a certain number (e.g.,
P(X≤7)
), but becomes more complicated when trying to calculate a range of values (e.g.,P(4≤X≤7)
).In this case, to calculate it using the currently available functions we would have to calculate the following
P(X≤7) - P(X≤3)
.For example, if we were using a binomial distribution of
X ~ B(11, 0.33)
, we would calculateP(4≤X≤7)
like this:Which gives us an output of
0.5096391069522413707200
.Therefore, I suggest adding an optional lower parameter to the cumulative probability functions, which would default to
0
if not passed into the function. This would make it easier to calculate the probability of a range of values without the need to subtract two probabilities. Additionally, this would increase the efficiency of the algorithm, as it would avoid the need for the functions to iterate twice through the same probabilities.The text was updated successfully, but these errors were encountered: