StatsCalculators.com

Geometric Distribution

Created:November 11, 2024

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.

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.

Formula:P(X=k)=p(1p)k1P(X = k) = p(1-p)^{k-1}

Where:

  • kk is the number of trials until first success (k ≥ 1)
  • pp is the probability of success on each trial

Properties

  • Mean: E(X)=1pE(X) = \frac{1} {p}
  • Variance: Var(X)=1pp2Var(X) = \frac{1 - p} {p ^ 2}

How to Calculate Geometric Distribution in R

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()

Related Calculators