Documentation

Linglib.Data.Statistics.Schema

Printed statistics: schema #

The primitive values of Data/Statistics/<Paper>.lean, the per-paper modules that scripts/gen_statistics.py generates from Data/Statistics/<Paper>.json. A paper's own coding labels (its factors, response types, predictors) become generated enums, and each table it prints becomes a generated structure with one row per printed line; this file holds only what every paper shares.

This is data: it imports nothing from Linglib/ and states no theorems about theories. A statistic is kept as printed, Decimal recording the digits so that 75 and 75.0 differ, and a study reads it through Decimal.toRat. A p-value is a PValue, kept with the relation it is printed with, so that p < .05 and p = .05 differ, and read at a level through PValue.Significant. What a study concludes from the numbers (a prototype, a preference, the effects it counts as found) is a definition in the study, not a stored label.

A decimal as printed: the value mantissa / 10 ^ exponent, with exponent the place of the last printed digit, the number of decimal places or the k of a printed power of ten 10^-k.

  • mantissa : ℤ
  • exponent : ℕ
Instances For
    def Data.Statistics.instDecidableEqDecimal.decEq (x✝ x✝¹ : Decimal) :
    Decidable (x✝ = x✝¹)
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      def Data.Statistics.instReprDecimal.repr :
      Decimal → ℕ → Std.Format
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        The printed value.

        Equations
        Instances For
          @[simp]
          @[simp]
          @[instance_reducible]
          Equations
          @[instance_reducible]
          Equations

          The printed value in hundredths, exact when at most two places are printed: a proportion printed to two places, in percent.

          Equations
          Instances For

            The printed value is the proportion k / n rounded to the printed places: the two differ by at most half a unit in the last printed place.

            Equations
            Instances For
              @[instance_reducible]
              instance Data.Statistics.Decimal.instDecidableRounds (d : Decimal) (k n : ℕ) :
              Decidable (d.Rounds k n)
              Equations
              theorem Data.Statistics.Decimal.rounds_iff {d : Decimal} {k n : ℕ} (hn : 0 < n) :
              d.Rounds k n ↔ |↑k / ↑n - d.toRat| ≤ 1 / (2 * 10 ^ d.exponent)

              The printed value is the percentage 100 * k / n rounded to the printed places.

              Equations
              Instances For

                Some count out of n rounds to the printed percentage.

                Equations
                Instances For
                  @[instance_reducible]
                  Equations

                  A p-value as printed: the relation compare p value it is printed with and the printed value, p < .001 as ⟨.lt, ⟨1, 3⟩⟩ and p = .03 as ⟨.eq, ⟨3, 2⟩⟩.

                  Instances For
                    def Data.Statistics.instDecidableEqPValue.decEq (x✝ x✝¹ : PValue) :
                    Decidable (x✝ = x✝¹)
                    Equations
                    Instances For
                      def Data.Statistics.instReprPValue.repr :
                      PValue → ℕ → Std.Format
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        A printed p-value is significant at level α when every p-value it allows is below α.

                        Equations
                        Instances For
                          @[simp]
                          theorem Data.Statistics.PValue.significant_lt {v : Decimal} {α : ℚ} :
                          { relation := Ordering.lt, value := v }.Significant α ↔ v.toRat ≤ α
                          @[simp]
                          theorem Data.Statistics.PValue.significant_eq {v : Decimal} {α : ℚ} :
                          { relation := Ordering.eq, value := v }.Significant α ↔ v.toRat < α
                          @[simp]
                          theorem Data.Statistics.PValue.not_significant_gt {v : Decimal} {α : ℚ} :
                          ¬{ relation := Ordering.gt, value := v }.Significant α
                          @[instance_reducible]
                          instance Data.Statistics.PValue.instDecidableSignificant (p : PValue) (α : ℚ) :
                          Decidable (p.Significant α)
                          Equations

                          The sign of a binary feature in the [+F] / [-F] notation.

                          Instances For
                            @[instance_reducible]
                            Equations
                            @[instance_reducible]
                            Equations
                            def Data.Statistics.instReprSign.repr :
                            Sign → ℕ → Std.Format
                            Equations
                            Instances For