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. The probability density function is defined as the Radon–Nikodym derivative of the law of X. 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 the push-forward measure of along X is absolutely continuous with respect to μ and they HaveLebesgueDecomposition.

Instances
    theorem MeasureTheory.HasPDF.aemeasurable {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] :
    ∀ {x : MeasurableSpace Ω} (X : ΩE) ( : MeasureTheory.Measure Ω) (μ : MeasureTheory.Measure E) [hX : MeasureTheory.HasPDF X ], AEMeasurable X

    A random variable that HasPDF is quasi-measure preserving.

    theorem MeasureTheory.HasPDF.congr {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] :
    ∀ {x : MeasurableSpace Ω} {X Y : ΩE} { : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E}, X =ᶠ[MeasureTheory.Measure.ae ] Y∀ [hX : MeasureTheory.HasPDF X ], MeasureTheory.HasPDF Y

    X HasPDF if there is a pdf f such that map X ℙ = μ.withDensity f.

    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, then pdf X is the Radon–Nikodym derivative of the push-forward measure of along X with respect to μ.

    Equations
    Instances For
      theorem MeasureTheory.set_lintegral_pdf_le_map {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} (X : ΩE) (ℙ : MeasureTheory.Measure Ω) (μ : autoParam (MeasureTheory.Measure E) _auto✝) {s : Set E} (hs : MeasurableSet s) :
      ∫⁻ (x : E) in s, MeasureTheory.pdf X xμ (MeasureTheory.Measure.map X ) s
      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.congr {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {X : ΩE} {Y : ΩE} (hXY : X =ᶠ[MeasureTheory.Measure.ae ] Y) :
      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.lintegral_pdf_mul {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {X : ΩE} [MeasureTheory.HasPDF X ] {f : EENNReal} (hf : AEMeasurable f) :
      ∫⁻ (x : E), MeasureTheory.pdf X x * f xμ = ∫⁻ (x : Ω), f (X x)

      The Law of the Unconscious Statistician for nonnegative random variables.

      theorem MeasureTheory.pdf.integral_pdf_smul {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {F : Type u_3} [NormedAddCommGroup F] [NormedSpace F] [MeasureTheory.IsFiniteMeasure ] {X : ΩE} [MeasureTheory.HasPDF X ] {f : EF} (hf : MeasureTheory.AEStronglyMeasurable f μ) :
      ∫ (x : E), ENNReal.toReal (MeasureTheory.pdf X x) f 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, pdf X x • f x ∂μ where μ is a measure on the codomain of X.

      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] {m : MeasurableSpace Ω} (X : ΩE) (support : Set E) (ℙ : MeasureTheory.Measure Ω) (μ : autoParam (MeasureTheory.Measure E) _auto✝) :

      A random variable X has uniform distribution on s if its push-forward measure is (μ s)⁻¹ • μ.restrict s.

      Equations
      Instances For
        theorem MeasureTheory.pdf.IsUniform.aemeasurable {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {X : ΩE} {s : Set E} (hns : μ s 0) (hnt : μ s ) (hu : MeasureTheory.pdf.IsUniform X s ) :
        theorem MeasureTheory.pdf.IsUniform.measure_preimage {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {X : ΩE} {s : Set E} (hns : μ s 0) (hnt : μ 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 Ω} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {X : ΩE} {s : Set E} (hns : μ s 0) (hnt : μ s ) (hu : MeasureTheory.pdf.IsUniform X s ) :
        theorem MeasureTheory.pdf.IsUniform.hasPDF {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {X : ΩE} {s : Set E} (hns : μ s 0) (hnt : μ s ) (hu : MeasureTheory.pdf.IsUniform X s ) :
        theorem MeasureTheory.pdf.IsUniform.pdf_eq_zero_of_measure_eq_zero_or_top {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {X : ΩE} {s : Set E} (hu : MeasureTheory.pdf.IsUniform X s ) (hμs : μ s = 0 μ s = ) :
        theorem MeasureTheory.pdf.IsUniform.pdf_toReal_ae_eq {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {X : ΩE} {s : Set E} (hms : MeasurableSet s) (hX : MeasureTheory.pdf.IsUniform X s ) :
        (fun (x : E) => ENNReal.toReal (MeasureTheory.pdf X x)) =ᶠ[MeasureTheory.Measure.ae μ] fun (x : E) => ENNReal.toReal (Set.indicator s ((μ s)⁻¹ 1) x)
        theorem MeasureTheory.pdf.IsUniform.integral_eq {Ω : Type u_1} {m : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} {X : Ω} {s : Set } (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.

        theorem MeasureTheory.pdf.indepFun_iff_pdf_prod_eq_pdf_mul_pdf {Ω : Type u_1} {E : Type u_2} [MeasurableSpace E] {m : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {F : Type u_3} [MeasurableSpace F] {ν : MeasureTheory.Measure F} {X : ΩE} {Y : ΩF} [MeasureTheory.IsFiniteMeasure ] [MeasureTheory.SigmaFinite μ] [MeasureTheory.SigmaFinite ν] [MeasureTheory.HasPDF (fun (ω : Ω) => (X ω, Y ω)) ] :
        ProbabilityTheory.IndepFun X Y MeasureTheory.pdf (fun (ω : Ω) => (X ω, Y ω)) =ᶠ[MeasureTheory.Measure.ae (MeasureTheory.Measure.prod μ ν)] fun (z : E × F) => MeasureTheory.pdf X z.1 * MeasureTheory.pdf Y z.2

        Random variables are independent iff their joint density is a product of marginal densities.