Skip to content

math.stats #

fn absdev #

fn absdev<T>(data []T) T

absdev calculates the average distance between each data point and the mean Based on https://en.wikipedia.org/wiki/Average_absolute_deviation

fn absdev_mean #

fn absdev_mean<T>(data []T, mean T) T

absdev_mean calculates the average distance between each data point and the provided mean Based on https://en.wikipedia.org/wiki/Average_absolute_deviation

fn covariance #

fn covariance<T>(data1 []T, data2 []T) T

covariance calculates directional association between datasets positive value denotes variables move in same direction and negative denotes variables move in opposite directions

fn covariance_mean #

fn covariance_mean<T>(data1 []T, data2 []T, mean1 T, mean2 T) T

covariance_mean computes the covariance of a dataset with means provided the recurrence relation

fn freq #

fn freq<T>(data []T, val T) int

freq calculates the Measure of Occurance Frequency of a given number Based on https://www.mathsisfun.com/data/frequency-distribution.html

fn geometric_mean #

fn geometric_mean<T>(data []T) T

geometric_mean calculates the central tendency of the given input array, product(data)**1/data.len Based on https://www.mathsisfun.com/numbers/geometric-mean.html

fn harmonic_mean #

fn harmonic_mean<T>(data []T) T

harmonic_mean calculates the reciprocal of the average of reciprocals of the given input array Based on https://www.mathsisfun.com/numbers/harmonic-mean.html

fn kurtosis #

fn kurtosis<T>(data []T) T

kurtosis calculates the measure of the 'tailedness' of the data by finding mean and standard of deviation

fn kurtosis_mean_stddev #

fn kurtosis_mean_stddev<T>(data []T, mean T, sd T) T

kurtosis_mean_stddev calculates the measure of the 'tailedness' of the data using the fourth moment the deviations, normalized by the sd

fn lag1_autocorrelation #

fn lag1_autocorrelation<T>(data []T) T

lag1_autocorrelation_mean calculates the correlation between values that are one time period apart of a dataset, based on the mean

fn lag1_autocorrelation_mean #

fn lag1_autocorrelation_mean<T>(data []T, mean T) T

lag1_autocorrelation_mean calculates the correlation between values that are one time period apart of a dataset, using the recurrence relation

fn max #

fn max<T>(data []T) T

max finds the maximum value from the dataset

fn max_index #

fn max_index<T>(data []T) int

max_index finds the first index of the maximum value

fn mean #

fn mean<T>(data []T) T

mean calculates the average of the given input array, sum(data)/data.len Based on https://www.mathsisfun.com/data/central-measures.html

fn median #

fn median<T>(sorted_data []T) T

median returns the middlemost value of the given input array ( input array is assumed to be sorted ) Based on https://www.mathsisfun.com/data/central-measures.html

fn min #

fn min<T>(data []T) T

min finds the minimum value from the dataset

fn min_index #

fn min_index<T>(data []T) int

min_index finds the first index of the minimum value

fn minmax #

fn minmax<T>(data []T) (T, T)

minmax finds the minimum and maximum value from the dataset

fn minmax_index #

fn minmax_index<T>(data []T) (int, int)

minmax_index finds the first index of the minimum and maximum value

fn mode #

fn mode<T>(data []T) T

mode calculates the highest occuring value of the given input array Based on https://www.mathsisfun.com/data/central-measures.html

fn population_stddev #

fn population_stddev<T>(data []T) T

population_stddev calculates how spread out the dataset is Based on https://www.mathsisfun.com/data/standard-deviation.html

fn population_stddev_mean #

fn population_stddev_mean<T>(data []T, mean T) T

population_stddev_mean calculates how spread out the dataset is, with the provide mean Based on https://www.mathsisfun.com/data/standard-deviation.html

fn population_variance #

fn population_variance<T>(data []T) T

population_variance is the Measure of Dispersion / Spread of the given input array Based on https://www.mathsisfun.com/data/standard-deviation.html

fn population_variance_mean #

fn population_variance_mean<T>(data []T, mean T) T

population_variance_mean is the Measure of Dispersion / Spread of the given input array, with the provided mean Based on https://www.mathsisfun.com/data/standard-deviation.html

fn quantile #

fn quantile<T>(sorted_data []T, f T) T

fn range #

fn range<T>(data []T) T

range calculates the difference between the min and max Range ( Maximum - Minimum ) of the given input array Based on https://www.mathsisfun.com/data/range.html

fn rms #

fn rms<T>(data []T) T

rms, Root Mean Square, calculates the sqrt of the mean of the squares of the given input array Based on https://en.wikipedia.org/wiki/Root_mean_square

fn sample_stddev #

fn sample_stddev<T>(data []T) T

Measure of Dispersion / Spread Sample Standard Deviation of the given input array Based on https://www.mathsisfun.com/data/standard-deviation.html

fn sample_stddev_mean #

fn sample_stddev_mean<T>(data []T, mean T) T

Measure of Dispersion / Spread Sample Standard Deviation of the given input array Based on https://www.mathsisfun.com/data/standard-deviation.html

fn sample_variance #

fn sample_variance<T>(data []T) T

sample_variance calculates the spread of dataset around the mean Based on https://www.mathsisfun.com/data/standard-deviation.html

fn sample_variance_mean #

fn sample_variance_mean<T>(data []T, mean T) T

sample_variance calculates the spread of dataset around the provided mean Based on https://www.mathsisfun.com/data/standard-deviation.html

fn skew #

fn skew<T>(data []T) T

skew calculates the mean and standard of deviation to find the skew from the data

fn skew_mean_stddev #

fn skew_mean_stddev<T>(data []T, mean T, sd T) T

skew_mean_stddev calculates the skewness of data

fn tss #

fn tss<T>(data []T) T

tts, Sum of squares, calculates the sum over all squared differences between values and overall mean

fn tss_mean #

fn tss_mean<T>(data []T, mean T) T

tts_mean, Sum of squares, calculates the sum over all squared differences between values and the provided mean