mathlib documentation

probability_theory.density

Probability density function #

This file defines the probability density function of random variables, by which we mean measurable functions taking values in a Borel space. In particular, a measurable function f is said to the probability density function of a random variable X if for all measurable sets S, ℙ(X ∈ S) = ∫ x in S, f x dx. Probability density functions are one way of describing the distribution of a random variable, and are useful for calculating probabilities and finding moments (although the latter is better achieved with moment generating functions).

This file also defines the continuous uniform distribution and proves some properties about random variables with this distribution.

Main definitions #

Main results #

TODOs #

Ultimately, we would also like to define characteristic functions to describe distributions as it exists for all random variables. However, to define this, we will need Fourier transforms which we currently do not have.

@[class]
structure measure_theory.has_pdf {α : Type u_1} {E : Type u_2} [normed_group E] [measurable_space E] [topological_space.second_countable_topology E] [normed_space E] [complete_space E] [borel_space E] {m : measurable_space α} (X : α → E) (ℙ : measure_theory.measure α) (μ : measure_theory.measure E . "volume_tac") :
Prop

A random variable X : α → E is said to has_pdf with respect to the measure on α and μ on E if there exists a measurable function f such that the push-forward measure of along X equals μ.with_density f.

noncomputable def measure_theory.pdf {α : Type u_1} {E : Type u_2} [normed_group E] [measurable_space E] [topological_space.second_countable_topology E] [normed_space E] [complete_space E] [borel_space E] {m : measurable_space α} (X : α → E) (ℙ : measure_theory.measure α) (μ : measure_theory.measure E . "volume_tac") :

If X is a random variable that has_pdf X ℙ μ, then pdf X is the measurable function f such that the push-forward measure of along X equals μ.with_density f.

Equations
theorem measure_theory.map_eq_set_lintegral_pdf {α : Type u_1} {E : Type u_2} [normed_group E] [measurable_space E] [topological_space.second_countable_topology E] [normed_space E] [complete_space E] [borel_space E] {m : measurable_space α} (X : α → E) (ℙ : measure_theory.measure α) (μ : measure_theory.measure E . "volume_tac") [hX : measure_theory.has_pdf X μ] {s : set E} (hs : measurable_set s) :
theorem measure_theory.pdf.integral_fun_mul_eq_integral {α : Type u_1} {E : Type u_2} [normed_group E] [measurable_space E] [topological_space.second_countable_topology E] [normed_space E] [complete_space E] [borel_space E] {m : measurable_space α} {ℙ : measure_theory.measure α} {μ : measure_theory.measure E} [measure_theory.is_finite_measure ℙ] {X : α → E} [measure_theory.has_pdf X μ] {f : E → } (hf : measurable f) :
(x : E), ((f x) * (measure_theory.pdf X μ x).to_real) μ = (x : α), f (X x)

The Law of the Unconscious Statistician: Given a random variable X and a measurable function f, f ∘ X is a random variable with expectation ∫ x, f x * pdf X ∂μ where μ is a measure on the codomain of X.

A random variable that has_pdf is quasi-measure preserving.

A random variable that has_pdf transformed under a quasi_measure_preserving map also has_pdf if (map g (map X ℙ)).have_lebesgue_decomposition μ.

quasi_measure_preserving_has_pdf' is more useful in the case we are working with a probability measure and a real-valued random variable.

A real-valued random variable X has_pdf X ℙ λ (where λ is the Lebesgue measure) if and only if the push-forward measure of along X is absolutely continuous with respect to λ.

If X is a real-valued random variable that has pdf f, then the expectation of X equals ∫ x, x * f x ∂λ where λ is the Lebesgue measure.

Uniform Distribution

def measure_theory.pdf.is_uniform {α : Type u_1} {E : Type u_2} [normed_group E] [measurable_space E] [topological_space.second_countable_topology E] [normed_space E] [complete_space E] [borel_space E] {m : measurable_space α} (X : α → E) (support : set E) (ℙ : measure_theory.measure α) (μ : measure_theory.measure E . "volume_tac") :
Prop

A random variable X has uniform distribution if it has a probability density function f with support s such that f = (μ s)⁻¹ 1ₛ a.e. where 1ₛ is the indicator function for s.

Equations
theorem measure_theory.pdf.is_uniform.has_pdf {α : Type u_1} {E : Type u_2} [normed_group E] [measurable_space E] [topological_space.second_countable_topology E] [normed_space E] [complete_space E] [borel_space E] {m : measurable_space α} {X : α → E} {ℙ : measure_theory.measure α} {μ : measure_theory.measure E} {support : set E} (hns : μ support 0) (hnt : μ support ) (hu : measure_theory.pdf.is_uniform X support μ) :
theorem measure_theory.pdf.is_uniform.pdf_to_real_ae_eq {α : Type u_1} {E : Type u_2} [normed_group E] [measurable_space E] [topological_space.second_countable_topology E] [normed_space E] [complete_space E] [borel_space E] {m : measurable_space α} {X : α → E} {ℙ : measure_theory.measure α} {μ : measure_theory.measure E} {s : set E} (hX : measure_theory.pdf.is_uniform X s μ) :
(λ (x : E), (measure_theory.pdf X μ x).to_real) =ᵐ[μ] λ (x : E), (s.indicator ((μ s)⁻¹ 1) x).to_real

A real uniform random variable X with support s has expectation (λ s)⁻¹ * ∫ x in s, x ∂λ where λ is the Lebesgue measure.