Skip to content

Fix incorrect formula for mean in geometric.jl #1 #1983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

mmogib
Copy link

@mmogib mmogib commented Jun 8, 2025

This pull request corrects the formula for the mean of the geometric distribution in geometric.jl.

The current formula is incorrect. The correct formula for the mean of a geometric distribution is:

$$ \mu = \frac{1}{p} $$

where $p$ is the probability of success.

References:

  1. Montgomery, D. C., & Runger, G. C. (2011). Applied Statistics and Probability for Engineers (5th ed.). Wiley. (p. 88)

  2. Wikipedia contributors. (2025, May 20). Geometric distribution. In Wikipedia, The Free Encyclopedia. Retrieved June 8, 2025, from https://en.wikipedia.org/w/index.php?title=Geometric_distribution&oldid=1291255291

mmogib added 2 commits June 8, 2025 12:33
The mean formula is incorrect. The correct formula is 
1/p
Fix incorrect formula for mean in geometric.jl
@devmotion
Copy link
Member

The formula is actually correct: The Geometric distribution in Distributions.jl models the number of failures until the first success with support 0, 1, 2, .... (right column in the table on the wikipedia page and the second definition discussed in the text). This distribution has mean (1-p)/p where p denotes the success probability, which is exactly how mean is currently defined in Distributions.jl.

@devmotion devmotion closed this Jun 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants