Skip to content
FutureBlitz

    Install

    Import std.math.stats

    std.math.stats

    Statistics of numbers of any type, worked out in Doubles: the mean, the median, the variance and standard deviation of a sample and of a whole population, percentiles, and histograms. Too few values for what's asked panics, as Python's statistics raises.

    std/math/stats.fb

    Functions

    Mean function

    @PanicsAtCaller Public Function Mean<T: Bounded>(values: T[]): Double

    The mean, the sum over the count, or the sum of each value's share where the sum overflows and the values don't. No values panics.

    std/math/stats.fb, line 35

    Median function

    @PanicsAtCaller Public Function Median<T: Bounded>(values: T[]): Double

    The middle value, or the mean of the two middle ones for an even count. No values, or a NaN, panics.

    std/math/stats.fb, line 55

    Variance function

    @PanicsAtCaller Public Function Variance<T: Bounded>(values: T[]): Double

    The variance of a sample, the squared differences from the mean over the count less 1, as an estimate of the variance of all it was drawn from. Fewer than two values panics.

    std/math/stats.fb, line 82

    StdDev function

    @PanicsAtCaller Public Function StdDev<T: Bounded>(values: T[]): Double

    The standard deviation of a sample: the square root of its Variance. Fewer than two values panics.

    std/math/stats.fb, line 90

    PopulationVariance function

    @PanicsAtCaller Public Function PopulationVariance<T: Bounded>(values: T[]): Double

    The variance of the values as the whole population: the squared differences from the mean over the count. No values panics.

    std/math/stats.fb, line 98

    PopulationStdDev function

    @PanicsAtCaller Public Function PopulationStdDev<T: Bounded>(values: T[]): Double

    The standard deviation of the values as the whole population: the square root of their PopulationVariance. No values panics.

    std/math/stats.fb, line 106

    Percentile function

    @PanicsAtCaller Public Function Percentile<T: Bounded>(values: T[], percent: Double): Double

    The value below which percent of them lie, from 0 for the least to 100 for the largest, between the two nearest when it falls between them, as NumPy's percentile does: 50 is the Median. No values, a NaN, or a percent outside 0 to 100, panics.

    std/math/stats.fb, line 115

    Histogram function

    @PanicsAtCaller Public Function Histogram<T: Bounded>(values: T[], bins: Int, low: Double, high: Double): Int[]

    How many values fall in each of bins equal ranges from low to high, the last range holding high too; those outside, and NaN, are left out. A count of bins that isn't above 0, or a low that isn't below high, or isn't finite, panics.

    std/math/stats.fb, line 151

    Histogram function

    @PanicsAtCaller Public Function Histogram<T: Bounded>(values: T[], bins: Int): Int[]

    How many values fall in each of bins equal ranges from the least value to the largest, which all do. No values, a NaN or an infinite one, or a count of bins that isn't above 0, panics.

    std/math/stats.fb, line 208

    Report an issue with this page or with FutureBlitz on GitHub.