Documentation

TauCeti.Probability.Distributions.FisherSnedecor.Basic

Fisher's F distribution #

Main definitions #

Main results #

This file begins the elementary API for Fisher's F law. For positive degrees of freedom m and n, it realizes the law as the image of betaMeasure (m / 2) (n / 2) under u ↦ (n / m) * u / (1 - u). This gives a probability measure without introducing a second probability-law abstraction. The density is derived from this pushforward by the same beta-to-F change of variables, rather than being used as a second definition of the law.

The change of variables is useful in its own right: the inverse map on the positive half-line is x ↦ m * x / (n + m * x). The cumulative distribution function, which reads the beta distribution function at this inverse, is in TauCeti.Probability.Distributions.FisherSnedecor.Cdf.

References #

The beta-to-F transformation #

noncomputable def TauCeti.Probability.fisherSnedecorMap (m n u : ℝ) :

The formula for the transformation from a beta variable to an F variable.

For positive m and n, this function is strictly monotone on Iio 1 and maps Ioo 0 1 onto Ioi 0.

Instances For
    theorem TauCeti.Probability.fisherSnedecorMap_def (m n u : ℝ) :
    fisherSnedecorMap m n u = n / m * u / (1 - u)

    The defining formula for fisherSnedecorMap.

    noncomputable def TauCeti.Probability.fisherSnedecorMapInv (m n x : ℝ) :

    The formula for the inverse transformation on the positive half-line.

    For positive m and n, this is the inverse of fisherSnedecorMap m n between Ioi 0 and Ioo 0 1.

    Instances For

      The defining formula for fisherSnedecorMapInv.

      The Fisher--Snedecor law with numerator degrees of freedom m and denominator degrees of freedom n. It is the law of (U / m) / (V / n) for independent chi-squared variables with degrees of freedom m and n; it is the zero measure unless 0 < m and 0 < n.

      Instances For
        @[simp]

        For invalid degrees of freedom, the Fisher--Snedecor measure is zero.

        For positive degrees of freedom, the Fisher--Snedecor measure is the beta-to-F pushforward.

        The Fisher--Snedecor measure is a probability measure for positive degrees of freedom.

        @[simp]

        The Fisher--Snedecor measure is a probability measure exactly when both degrees of freedom are positive.

        The beta-to-F transformation is measurable for all parameter values.

        The beta-to-F inverse transformation is measurable for all parameter values.

        Support and the inverse #

        theorem TauCeti.Probability.fisherSnedecorMap_mem_Ioi {m n : ℝ} (hm : 0 < m) (hn : 0 < n) {u : ℝ} (hu : u ∈ Set.Ioo 0 1) :

        For positive degrees of freedom, the beta-to-F map sends Ioo 0 1 into Ioi 0.

        For positive degrees of freedom, the beta-to-F map is strictly monotone on Iio 1.

        theorem TauCeti.Probability.hasDerivAt_fisherSnedecorMap (m n : ℝ) {u : ℝ} (hu : u ≠ 1) :
        HasDerivAt (fisherSnedecorMap m n) (n / m * ((1 - u) ^ 2)⁻¹) u

        The derivative of the beta-to-F transformation away from its pole at one.

        @[simp]
        theorem TauCeti.Probability.fisherSnedecorMapInv_map {m n : ℝ} (hm : m ≠ 0) (hn : n ≠ 0) {u : ℝ} (hu : u ≠ 1) :

        If m ≠ 0, n ≠ 0, and u ≠ 1, the inverse transformation after the beta-to-F map is the identity.

        @[simp]
        theorem TauCeti.Probability.fisherSnedecorMap_mapInv {m n : ℝ} (hm : m ≠ 0) (hn : n ≠ 0) {x : ℝ} (hden : n + m * x ≠ 0) :

        If m ≠ 0, n ≠ 0, and n + m * x ≠ 0, the beta-to-F map after the inverse transformation is the identity.

        @[simp]
        theorem TauCeti.Probability.fisherSnedecorMap_div_add {m n u v : ℝ} (huv : u + v ≠ 0) :
        fisherSnedecorMap m n (u / (u + v)) = u / m / (v / n)

        If u + v ≠ 0, the beta-to-F transformation with m and n degrees of freedom sends the ratio-to-sum u / (u + v) to the variance ratio (u / m) / (v / n); equivalently, it inverts the passage from a variance ratio to the fraction of the total that its numerator carries.

        theorem TauCeti.Probability.fisherSnedecorMapInv_mem_Ioo {m n : ℝ} (hm : 0 < m) (hn : 0 < n) {x : ℝ} (hx : 0 < x) :

        For positive degrees of freedom, the inverse transformation maps Ioi 0 into Ioo 0 1.

        For positive degrees of freedom, the beta-to-F map sends Ioo 0 1 onto Ioi 0.

        The Fisher--Snedecor law is almost surely positive, including vacuously for invalid parameters.

        Density #

        The real-valued Fisher--Snedecor density with numerator degrees of freedom m and denominator degrees of freedom n.

        It is zero unless both parameters and the sample point are positive.

        Instances For

          The Fisher--Snedecor density, valued in ℝ≥0∞.

          Instances For

            The ℝ≥0∞-valued Fisher--Snedecor density is the nonnegative coercion of its real-valued version.

            @[simp]
            theorem TauCeti.Probability.fisherSnedecorPDFReal_of_pos {m n x : ℝ} (hm : 0 < m) (hn : 0 < n) (hx : 0 < x) :
            fisherSnedecorPDFReal m n x = Real.Gamma ((m + n) / 2) / (Real.Gamma (m / 2) * Real.Gamma (n / 2)) * (m / n) ^ (m / 2) * x ^ (m / 2 - 1) * (1 + m * x / n) ^ (-((m + n) / 2))

            The real density has its usual formula at valid parameters and a positive point.

            @[simp]

            The real density vanishes on the nonpositive half-line.

            @[simp]

            The real density vanishes unless both degrees of freedom are positive.

            @[simp]
            theorem TauCeti.Probability.fisherSnedecorPDF_of_pos {m n x : ℝ} (hm : 0 < m) (hn : 0 < n) (hx : 0 < x) :
            fisherSnedecorPDF m n x = ENNReal.ofReal (Real.Gamma ((m + n) / 2) / (Real.Gamma (m / 2) * Real.Gamma (n / 2)) * (m / n) ^ (m / 2) * x ^ (m / 2 - 1) * (1 + m * x / n) ^ (-((m + n) / 2)))

            The ℝ≥0∞-valued density has its usual formula at valid parameters and a positive point.

            @[simp]

            The ℝ≥0∞-valued density vanishes on the nonpositive half-line.

            @[simp]
            theorem TauCeti.Probability.fisherSnedecorPDF_of_not_pos {m n : ℝ} (h : ¬(0 < m ∧ 0 < n)) (x : ℝ) :

            The ℝ≥0∞-valued density vanishes unless both degrees of freedom are positive.

            The real-valued Fisher--Snedecor density is nonnegative.

            @[simp]

            Converting the Fisher--Snedecor density back to ℝ recovers its real-valued version.

            The real Fisher--Snedecor density is measurable in the sample point.

            The ℝ≥0∞-valued Fisher--Snedecor density is measurable in the sample point.

            The Fisher--Snedecor density is supported on the positive half-line.

            theorem TauCeti.Probability.fisherSnedecorPDFReal_eq_scaled_beta {m n x : ℝ} (hm : 0 < m) (hn : 0 < n) (hx : 0 < x) :
            fisherSnedecorPDFReal m n x = m / n * (1 / ProbabilityTheory.beta (m / 2) (n / 2)) * (m * x / n) ^ (m / 2 - 1) * (1 + m * x / n) ^ (-((m + n) / 2))

            The classical Fisher density in the scaled beta-prime form used by its change of variables.

            The density of the Fisher--Snedecor law, including the zero density at invalid parameters.

            Integrability transfer. A function is integrable against a Fisher--Snedecor law exactly when its density-weighted version is Lebesgue integrable. This holds at every parameter, the zero measure included.

            Integral transfer. An integral against a Fisher--Snedecor law is the density-weighted Lebesgue integral. This holds at every parameter, the zero measure included.

            A random variable with a Fisher--Snedecor law has the corresponding density.

            The Radon--Nikodym derivative of a Fisher--Snedecor law against Lebesgue measure.

            @[simp]

            For positive degrees of freedom the topological support of Fisher's F law is the closed nonnegative half-line.