This calculator helps you compute the probabilities of a geometric distribution given the probability of success (p). You can find the probability of a value being equal to, less than, greater than, or between certain values. The geometric distribution models the number of failures before the first success in a sequence of independent Bernoulli trials. The distribution chart shows the probability mass function (PMF) and cumulative distribution function (CDF) of the geometric distribution.
Different Conventions
Note: There are two different ways to define the geometric distribution:
- This calculator uses the number of trials until first success convention (as in Python's SciPy), where X ≥ 1
- Some other software (like R's
dgeom
) uses the number of failures before first success convention, where X ≥ 0
If you're calculating the probability of the number of failures before the first success, you can adjust the input values accordingly. For example, if you want to find the probability of 3 failures before the first success, set x1 = 4
in the calculator.
Calculator
Parameters
Interactive Distribution Chart
Learn More
Geometric Distribution: Definition, Formula, and Examples
Geometric Distribution
Definition: The geometric distribution models the number of trials needed to achieve the first success in a sequence of independent Bernoulli trials, where each trial has the same probability of success.
Where:
- is the number of trials until first success (k ≥ 1)
- is the probability of success on each trial
Properties
- Mean:
- Variance:
How to Calculate Geometric Distribution in R
library(tidyverse)
p <- 0.3
x_values <- 0:10
pmf_df <- tibble(
x = x_values,
probability = dgeom(x_values-1, prob = p) # Adjusted for R's 0-based indexing
)
set.seed(42)
samples_df <- tibble(
sample = rgeom(1000, prob = p)
)
ggplot(pmf_df, aes(x = x, y = probability)) +
geom_col(fill = "skyblue", alpha = 0.7) +
geom_text(aes(label = round(probability, 3)), vjust = -0.5, size = 3) +
labs(title = "Geometric Distribution PMF",
subtitle = paste("p =", p),
x = "Number of failures before first success",
y = "Probability") +
theme_minimal()