Documentation

Mathlib.Probability.ProbabilityMassFunction.Binomial

The binomial distribution #

This file defines the probability mass function of the binomial distribution.

Main results #

def PMF.binomial (p : NNReal) (h : p ≀ 1) (n : β„•) :
PMF (Fin (n + 1))

The binomial PMF: the probability of observing exactly i β€œheads” in a sequence of n independent coin tosses, each having probability p of coming up β€œheads”.

Equations
    Instances For
      theorem PMF.binomial_apply (p : NNReal) (h : p ≀ 1) (n : β„•) (i : Fin (n + 1)) :
      (binomial p h n) i = ↑p ^ ↑i * (1 - ↑p) ^ (↑(Fin.last n) - ↑i) * ↑(n.choose ↑i)
      @[simp]
      theorem PMF.binomial_apply_zero (p : NNReal) (h : p ≀ 1) (n : β„•) :
      (binomial p h n) 0 = (1 - ↑p) ^ n
      @[simp]
      theorem PMF.binomial_apply_last (p : NNReal) (h : p ≀ 1) (n : β„•) :
      (binomial p h n) (Fin.last n) = ↑p ^ n
      theorem PMF.binomial_apply_self (p : NNReal) (h : p ≀ 1) (n : β„•) :
      (binomial p h n) (Fin.last n) = ↑p ^ n
      theorem PMF.binomial_one_eq_bernoulli (p : NNReal) (h : p ≀ 1) :
      binomial p h 1 = map (fun (x : Bool) => bif x then 1 else 0) (bernoulli p h)

      The binomial distribution on one coin is the Bernoulli distribution.