Uniform distributions and probability mass functions #
This file defines two related notions of uniform distributions, which will be unified in the future.
Uniform distributions #
Defines the uniform distribution for any set with finite measure.
Main definitions #
IsUniform X s ℙ μ
: A random variableX
has uniform distribution ons
underℙ
if the push-forward measure agrees with the rescaled restricted measureμ
.
Uniform probability mass functions #
This file defines a number of uniform PMF
distributions from various inputs,
uniformly drawing from the corresponding object.
Main definitions #
PMF.uniformOfFinset
gives each element in the set equal probability,
with 0
probability for elements not in the set.
PMF.uniformOfFintype
gives all elements equal probability,
equal to the inverse of the size of the Fintype
.
PMF.ofMultiset
draws randomly from the given Multiset
, treating duplicate values as distinct.
Each probability is given by the count of the element divided by the size of the Multiset
TODO #
A random variable X
has uniform distribution on s
if its push-forward measure is
(μ s)⁻¹ • μ.restrict s
.
Equations
- MeasureTheory.pdf.IsUniform X s ℙ μ = (MeasureTheory.Measure.map X ℙ = ProbabilityTheory.cond μ s)
Instances For
A real uniform random variable X
with support s
has expectation
(λ s)⁻¹ * ∫ x in s, x ∂λ
where λ
is the Lebesgue measure.
The density of the uniform measure on a set with respect to itself. This allows us to abstract away the choice of random variable and probability space.
Equations
- MeasureTheory.pdf.uniformPDF s x μ = s.indicator ((μ s)⁻¹ • 1) x
Instances For
Check that indeed any uniform random variable has the uniformPDF.
Alternative way of writing the uniformPDF.
Uniform distribution taking the same non-zero probability on the nonempty finset s
Equations
- PMF.uniformOfFinset s hs = PMF.ofFinset (fun (a : α) => if a ∈ s then (↑s.card)⁻¹ else 0) s ⋯ ⋯
Instances For
The uniform pmf taking the same uniform value on all of the fintype α
Equations
- PMF.uniformOfFintype α = PMF.uniformOfFinset Finset.univ ⋯
Instances For
Given a non-empty multiset s
we construct the PMF
which sends a
to the fraction of
elements in s
that are a
.
Equations
- PMF.ofMultiset s hs = ⟨fun (a : α) => ↑(Multiset.count a s) / ↑s.card, ⋯⟩