sample_statistics library

Utilities and functions for calculating sample statistics and generating random samples.

SampleStats

Extensions

Export
Extension on `List<num>` providing the methods `export` and `exportHistogram`.
Factorial
Adds the getter `factorial`.
MinMaxSum
Extension on `Iterable<num>` providing the getters: `min`, `max`, and `sum`.
Roots
Extension on `num` providing the method `root`.
StatisticsUtils
Extension on `List<num>` providing the method `removeOutliers`.

Constants

invSqrt2 → const double
Constant: 1.0/sqrt(2).
`1.0 / math.sqrt2`
invSqrt2Pi → const double
Constant: 1.0/(sqrt(2*pi)).
`1.0 / sqrt2Pi`
invSqrtPi → const double
Constant: 1.0/(sqrt(pi)).
`1.0 / sqrtPi`
sqrt2Pi → const double
Constant: sqrt(2.0*pi).
`math.sqrt2 * sqrtPi`
sqrtPi → const double
Square root of pi.
`1.77245385090551602729816748334`

Properties

erf
Returns an approximation of the real valued error function defined as: `erf(x) = 2/sqrt(pi) * integral(from: 0, to: x, exp(-t*t), dt)`
final
erfTable Map<double, double>
Error function table.
final

Functions

dxErf(num x) num
Returns the first derivative of the error function.
expCdf(num x, num mean) num
Exponential cumulative probability density function with non-zero support over the interval `(0, inf)`.
expPdf(num x, num mean) num
Exponential density function with non-zero support over the interval `(0, inf)`.
integrate(num func(num x), num lowerLimit, num upperLimit, {double dxMax = 0.1}) num
Returns the definite integral of `func` over the interval (`lowerLimit`,`upperLimit`) using the trapezoidal approximation.
meanTruncatedNormal(num min, num max, num mean, num stdDev) num
Returns the mean of a truncated normal distribution with minimum value `min`, maximum value `max`, mean `mean`, and standard deviation `stdDev`.
normalCdf(num x, num mean, num stdDev) num
Normal cumulative probability density function.
normalPdf(num x, num mean, num stdDev) num
Normal probability density function.
polynomial(num x, a) num
Returns the polynominal defined by the coefficients `a`: `a[0] + a[1] * x + ... + a[n-1] * pow(x, n - 1)`.
sampleExponentialPdf(int n, num mean, {int seed}) List<num>
Returns a random sample of size `n` following an exponential distribution.
sampleNormalPdf(int n, num mean, num stdDev, {num min, num max, int seed}) List<num>
Returns a random sample of size `n` following a normal distribution with parameters:
samplePdf(int n, num min, num max, num probDistMax, {int seed}) List<num>
Returns a random sample with probability density `probabilityDensity`.
sampleTriangularPdf(int n, num min, num max, {int seed}) List<num>
Returns a random sample following a symmetric triangular distribution with non-zero support over the range `(min, max)`.
sampleTruncatedNormalPdf(int n, num min, num max, num mean, num stdDev, {int seed}) List<num>
Returns a random sample of size `n` following a truncated normal distribution with:
sampleUniformPdf(int n, num min, num max, {int seed}) List<num>
Returns a random sample following a uniform distribution with non-zero support over the range `(min, max)`.
stdDevTruncatedNormal(num min, num max, num mean, num stdDev) num
Returns the standard deviation of a truncated normal distribution with minimum value `min`, maximum value `max`, mean `mean`, and standard deviation `stdDev`.
stdNormalCdf(num x) num
Standard normal cumulative probability distribution.
stdNormalPdf(num x) num
Standard normal probability density function (with zero mean and standard deviation equal to one) .
triangularCdf(num x, num min, num max) num
Triangular cumulative probability density function with non-zero support over the interval `(min, max)`.
triangularPdf(num x, num min, num max) num
Triangular probability density function with non-zero support over the interval `(min, max)`.
truncatedNormalCdf(num x, num min, num max, num mean, num stdDev) num
Truncated normal cumulative probability density function with parameters:
truncatedNormalPdf(num x, num min, num max, num mean, num stdDev) num
Truncated normal probability density function with parameters:
uniformCdf(num x, num min, num max) num
Uniform cumulative probability density function with non-zero support over the interval `(min, max)`.
uniformPdf(num x, num min, num max) num
Uniform probability density function with non-zero support over the interval `(min, max)`.

Typedefs

ProbabilityDensity = num Function(num x)
A probability density function.