Documentation

Mathlib.Probability.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 MeasureTheory.HasPDF {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} (X : ΩE) (ℙ : MeasureTheory.Measure Ω) (μ : autoParam (MeasureTheory.Measure E) _auto✝) :

A random variable X : Ω → E is said to HasPDF 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 μ.withDensity f.

Instances
    theorem MeasureTheory.HasPDF.measurable {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] :
    ∀ {x : MeasurableSpace Ω} (X : ΩE) ( : MeasureTheory.Measure Ω) (μ : autoParam (MeasureTheory.Measure E) _auto✝) [hX : MeasureTheory.HasPDF X ], Measurable X
    def MeasureTheory.pdf {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] :
    {x : MeasurableSpace Ω} → (ΩE) → MeasureTheory.Measure ΩautoParam (MeasureTheory.Measure E) _auto✝EENNReal

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

    Instances For
      theorem MeasureTheory.pdf_undef {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {X : ΩE} (h : ¬MeasureTheory.HasPDF X ) :
      theorem MeasureTheory.pdf_eq_zero_of_not_measurable {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] :
      ∀ {x : MeasurableSpace Ω} { : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {X : ΩE}, ¬Measurable XMeasureTheory.pdf X = 0
      theorem MeasureTheory.map_eq_set_lintegral_pdf {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} (X : ΩE) (ℙ : MeasureTheory.Measure Ω) (μ : autoParam (MeasureTheory.Measure E) _auto✝) [hX : MeasureTheory.HasPDF X ] {s : Set E} (hs : MeasurableSet s) :
      ↑(MeasureTheory.Measure.map X ) s = ∫⁻ (x : E) in s, MeasureTheory.pdf X xμ
      theorem MeasureTheory.pdf.lintegral_eq_measure_univ {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {X : ΩE} [MeasureTheory.HasPDF X ] :
      ∫⁻ (x : E), MeasureTheory.pdf X xμ = Set.univ
      theorem MeasureTheory.pdf.ae_lt_top {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} [MeasureTheory.IsFiniteMeasure ] {μ : MeasureTheory.Measure E} {X : ΩE} :
      ∀ᵐ (x : E) ∂μ, MeasureTheory.pdf X x <
      theorem MeasureTheory.pdf.integral_fun_mul_eq_integral {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} [MeasureTheory.IsFiniteMeasure ] {X : ΩE} [MeasureTheory.HasPDF X ] {f : E} (hf : Measurable f) :
      ∫ (x : E), f x * ENNReal.toReal (MeasureTheory.pdf X x)μ = ∫ (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 HasPDF is quasi-measure preserving.

      A random variable that HasPDF transformed under a QuasiMeasurePreserving map also HasPDF if (map g (map X ℙ)).HaveLebesgueDecomposition μ.

      quasiMeasurePreserving_hasPDF 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 HasPDF X ℙ λ (where λ is the Lebesgue measure) if and only if the push-forward measure of along X is absolutely continuous with respect to λ.

      theorem MeasureTheory.pdf.integral_mul_eq_integral {Ω : Type u_1} {m : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} [MeasureTheory.IsFiniteMeasure ] {X : Ω} [MeasureTheory.HasPDF X ] :
      ∫ (x : ), x * ENNReal.toReal (MeasureTheory.pdf X x) = ∫ (x : Ω), X x

      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.

      theorem MeasureTheory.pdf.hasFiniteIntegral_mul {Ω : Type u_1} {m : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} [MeasureTheory.IsFiniteMeasure ] {X : Ω} {f : } {g : ENNReal} (hg : MeasureTheory.pdf X =ᶠ[MeasureTheory.Measure.ae MeasureTheory.volume] g) (hgi : ∫⁻ (x : ), f x‖₊ * g x ) :

      Uniform Distribution

      def MeasureTheory.pdf.IsUniform {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] :
      {x : MeasurableSpace Ω} → (ΩE) → Set EMeasureTheory.Measure ΩautoParam (MeasureTheory.Measure E) _auto✝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.

      Instances For
        theorem MeasureTheory.pdf.IsUniform.hasPDF {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} {X : ΩE} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {s : Set E} (hns : μ s 0) (hnt : μ s ) (hu : MeasureTheory.pdf.IsUniform X s ) :
        theorem MeasureTheory.pdf.IsUniform.pdf_toReal_ae_eq {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] :
        ∀ {x : MeasurableSpace Ω} {X : ΩE} { : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {s : Set E}, MeasureTheory.pdf.IsUniform X s (fun x_1 => ENNReal.toReal (MeasureTheory.pdf X x_1)) =ᶠ[MeasureTheory.Measure.ae μ] fun x => ENNReal.toReal (Set.indicator s ((μ s)⁻¹ 1) x)
        theorem MeasureTheory.pdf.IsUniform.measure_preimage {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} {X : ΩE} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {s : Set E} (hns : μ s 0) (hnt : μ s ) (hms : MeasurableSet s) (hu : MeasureTheory.pdf.IsUniform X s ) {A : Set E} (hA : MeasurableSet A) :
        (X ⁻¹' A) = μ (s A) / μ s
        theorem MeasureTheory.pdf.IsUniform.isProbabilityMeasure {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} {X : ΩE} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {s : Set E} (hns : μ s 0) (hnt : μ s ) (hms : MeasurableSet s) (hu : MeasureTheory.pdf.IsUniform X s ) :
        theorem MeasureTheory.pdf.IsUniform.mul_pdf_integrable {Ω : Type u_1} {m : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} {X : Ω} {s : Set } (hms : MeasurableSet s) (hns : MeasureTheory.volume s 0) [MeasureTheory.IsFiniteMeasure ] (hcs : IsCompact s) (huX : MeasureTheory.pdf.IsUniform X s ) :
        theorem MeasureTheory.pdf.IsUniform.integral_eq {Ω : Type u_1} {m : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} {X : Ω} {s : Set } (hms : MeasurableSet s) (hns : MeasureTheory.volume s 0) (hnt : MeasureTheory.volume s ) (huX : MeasureTheory.pdf.IsUniform X s ) :
        ∫ (x : Ω), X x = ENNReal.toReal (MeasureTheory.volume s)⁻¹ * ∫ (x : ) in s, x

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