Abstract
Statistics functions parameterised over the concrete representation of reals.
Synopsis
module type statistics = {
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
module mk_statistics | : | (R: float) -> statistics with t = R.t |
Description
- ↑module type statistics
- ↑type t
The type of scalars that the functions operate on.
- ↑val mean [n]: [n]t -> t
mean vs
returns the arithmetic mean of the values contained invs
.- ↑val gmean [n]: [n]t -> t
gmean vs
returns the geometric mean of the values contained invs
.- ↑val hmean [n]: [n]t -> t
hmean vs
returns the harmonic mean of the values contained invs
.- ↑val qmean [n]: [n]t -> t
qmean vs
returns the quadratic mean of the values contained invs
. Also known as "root mean square".- ↑val variance [n]: [n]t -> t
variance vs
returns the sample variance of the values contained invs
. The sample variance is the square of the sample standard deviation.- ↑val stddev [n]: [n]t -> t
stddev vs
returns the sample standard deviation of the values contained invs
. The sample standard deviation is the square root of the sample variance.- ↑val covariance [n]: [n]t -> [n]t -> t
covariance xs ys
returns the sample covariance between the values contained inxs
andys
.- ↑val correlation [n]: [n]t -> [n]t -> t
correlation xs ys
returns the sample (Pearson) correlation between the values contained inxs
andys
.- ↑val variance_pop [n]: [n]t -> t
variance_pop vs
returns the population variance of the values contained invs
. The population variance is the square of the population standard deviation.- ↑val stddev_pop [n]: [n]t -> t
stddev_pop vs
returns the population standard deviation of the values contained invs
. The population standard deviation is the square root of the population variance.- ↑val skewness [n]: [n]t -> t
skewness vs
returns the skewness of the values contained invs
. The skewness measures the assymetry of the values invs
. If the skewness is positive, the upper tail is thicker than the lower tail, whereas, if the skewness is negative, the lower tail is thicker than the upper tail. The skewness of a set of normally distributed values is zero.- ↑val skewness_adj [n]: [n]t -> t
skewness_adj vs
returns the adjusted Fisher-Pearson coefficient of skewness for the values contained invs
.- ↑val kurtosis [n]: [n]t -> t
kurtosis vs
returns the (non-excess) kurtosis of the values contained invs
.- ↑val kurtosis_excess [n]: [n]t -> t
kurtosis_excess vs
returns the excess kurtosis of the values contained invs
.- ↑val median [n]: [n]t -> t
Median value of array.
- ↑val median_sorted [n]: [n]t -> t
Median value of sorted array.
- ↑val quantile [n]: [n]t -> t -> t
Quantile of array.
- ↑val quantile_sorted [n]: [n]t -> t -> t
Quantile of sorted array.
- ↑val mode [n]: [n]t -> t
The most frequently occuring element of an array.
- ↑val mode_sorted [n]: [n]t -> t
The most frequently occuring element of a sorted array.
- ↑type regression_result = {beta: t, mu: t}
beta
is the slope andmu
is the mean.- ↑val regress [n]: [n]t -> [n]t -> regression_result
Linear regression in two variables.
- ↑val erf: t -> t
erf x
returns a polynomial approximation to the Gauss error function applied tox
. The maximal approximation error is 0.00000012 for any argumentx
.- ↑val gamma: t -> t
gamma x
returns the value(x-1)!
for positive integer valuesx
. Extended to work for positive non-integer values.- ↑val gammaln: t -> t
gammaln x
returnsln((x-1)!)
, extended to work with positive non-integer values. Notice thatgammaln
is numerically stable in contrast to calculatinglog(gamma x)
with largex
s.- ↑type^ dist 'a
Generic type for distributions. Discrete distributions have type
dist i32
, whereas continuous distributions have typedist t
.- ↑val mk_poison: {lambda: t} -> dist i32
- ↑val mk_normal: {mu: t, sigma: t} -> dist t
- ↑val mk_uniform: {a: t, b: t} -> dist t
- ↑val pmf: dist i32 -> i32 -> t
- ↑val pdf: dist t -> t -> t
- ↑val cdf 'a: dist a -> a -> t
- ↑val sample 'a: dist a -> t -> a
sample d r
returns a sample from the distributiond
given a real valuer
taken from a uniform distribution U(0,1).
- ↑module mk_statistics