Documentation

Mathlib.Probability.Distributions.Binomial

Binomial random variables #

This file defines the binomial distribution and binomial random variables, and computes their expectation and variance. For n : ℕ and p : I, the binomial distribution Bin(n, p) is defined as the cardinal of a random subset U of Set.Iic n such that each k ∈ Set.Iic n belongs to U independently with probability p.

Main definition #

Implementation details #

We provide the definition binomial with notation Bin(n, P) as the corresponding measure over . We also introduce a notation Bin(R, n p) for the same measure but over a general AddMonoidWithOne R, that stands for Bin(n, p).map (Nat.cast : ℕ → R). This is in particular useful if one is interested in the binomial distribution as a measure over or . Results should be proven for both Bin(n, p) and Bin(R, n, p) when possible, using the first one to prove the second. Note that results concerning Bin(R, n, p) may require [MeasurableSingletonClass R] and/or [CharZero R].

When refering to Bin(n, p) in names, use binomial. When refering to Bin(R, n, p), use map_cast_binomial.

Notation #

Bin(n, p) is the binomial distribution with parameters n and p in . Bin(R, n, p) is the binomial distribution with parameters n and p in R.

The binomial probability distribution with parameter p.

Equations
Instances For

    The binomial probability distribution with parameter p.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      The binomial probability distribution with parameter p valued in the semiring R.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        theorem ProbabilityTheory.ae_le_of_hasLaw_binomial {Ω : Type u_2} {m : MeasurableSpace Ω} {P : MeasureTheory.Measure Ω} {n : } {p : unitInterval} {X : Ω} (hX : HasLaw X (binomial n p) P) :
        ∀ᵐ (ω : Ω) P, X ω n
        theorem ProbabilityTheory.binomial_real_singleton (n k : ) (p : unitInterval) :
        (binomial n p).real {k} = (n.choose k) * p ^ k * (1 - p) ^ (n - k)
        theorem ProbabilityTheory.binomial_singleton (n k : ) (p : unitInterval) :
        (binomial n p) {k} = ENNReal.ofReal ((n.choose k) * p ^ k * (1 - p) ^ (n - k))
        @[simp]
        theorem ProbabilityTheory.binomial_nonneg {n : } {p : unitInterval} {k : } :
        0 (n.choose k) * p ^ k * (1 - p) ^ (n - k)
        @[simp]
        theorem ProbabilityTheory.binomial_real_zero (n : ) (p : unitInterval) :
        (binomial n p).real {0} = (1 - p) ^ n
        @[simp]
        theorem ProbabilityTheory.binomial_real_self (n : ) (p : unitInterval) :
        (binomial n p).real {n} = p ^ n
        theorem ProbabilityTheory.binomial_eq_sum_dirac (n : ) (p : unitInterval) :
        binomial n p = kFinset.Iic n, ENNReal.ofReal ((n.choose k) * p ^ k * (1 - p) ^ (n - k)) MeasureTheory.Measure.dirac k
        theorem ProbabilityTheory.integral_binomial {n : } {p : unitInterval} {E : Type u_3} [NormedAddCommGroup E] [NormedSpace E] [CompleteSpace E] (f : E) :
        (x : ), f x binomial n p = kFinset.Iic n, ((n.choose k) * p ^ k * (1 - p) ^ (n - k)) f k
        theorem ProbabilityTheory.integral_map_cast_binomial {R : Type u_1} [MeasurableSpace R] [AddMonoidWithOne R] {n : } {p : unitInterval} {E : Type u_3} [NormedAddCommGroup E] [NormedSpace E] [CompleteSpace E] [MeasurableSingletonClass R] (f : RE) :
        (x : R), f x MeasureTheory.Measure.map Nat.cast (binomial n p) = kFinset.Iic n, ((n.choose k) * p ^ k * (1 - p) ^ (n - k)) f k

        Binomial random variables #