Discrete distribution

Binomial distribution

The number of successes in independent trials that each succeed with the same probability : heads in flips, defective parts in a batch of , correct guesses on a multiple-choice test. It is the sum of independent Bernoulli() variables.

Binomial probability calculator

P(X ≤ 3) = 0.649611

At the parameters set by the sliders. The shaded region on the plot is the probability; the dots on the CDF mark F at its ends. For a discrete distribution, < and ≤ differ.

PMF

00.10.20246810P(X = k)mean

CDF

00.250.50.7510246810F(x)

mean 3 · variance 2.1 · sd 1.449 · mode 3

Formulas

Parameters
  • , the number of trials
  • , the probability of success on each
Support
PMF
CDF
Mean
Variance
Mode
MGF

is the regularized incomplete beta function, which is how libraries evaluate the CDF.

Worked example

A quiz has 10 multiple-choice questions with 4 options each. A student guesses every answer. What is the probability of getting at least 5 right?

The number right is . About one guesser in thirteen passes. answer checked by code

How it relates to others

All the relationships, as a diagram →

In Python

from scipy import stats
import numpy as np

X = stats.binom(n=10, p=0.3)
X.pmf(3)  # P(X = 3) = 0.2668
X.cdf(3)  # P(X ≤ 3) = 0.6496
X.mean(), X.var()  # 3, 2.1
X.ppf(0.95)  # 95th percentile
X.rvs(size=10, random_state=0)

rng = np.random.default_rng(0)
rng.binomial(n=10, p=0.3, size=10)

Choosing between this and its neighbours? Which distribution for count data? · Which distribution for proportions and probabilities? · Which prior distribution should I use?

← BernoulliBeta-binomial →