numbers.statistic

numbers.statistic.correlation(arr1, arr2)

Calculates the correlation between two sets of values, arr1 and arr2.

Parameters

arr1 : Array

First set of values.

arr2 : Array

Second set of values.

Returns

cor : Number

The correlation between arr1, arr2.

Errors

An error is thrown if:

  • arr1 and arr2 do not have the same number of values

numbers.statistic.covariance(arr1, arr2)

Calculates the correlation between two sets of values, arr1 and arr2.

Parameters

arr1 : Array

First set of values.

arr2 : Array

Second set of values.

Returns

covar : Number

The covariance of arr1, arr2

Errors

An error is thrown if:

  • arr1 and arr2 do not have the same number of values

numbers.statistic.exponentialRegression(arrY)

Creates a function to calculate the exponential regression of a set of values, arrY.

Parameters

arrY : Array

A set of values.

Returns

expReg : Function

A function that takes a value or an array of values and calculates the corresponding exponential regression values.

Errors

This function does not raise any errors.


numbers.statistic.linearRegression(arrX, arrY)

Creates a function to calculate the linear regression of a dataset, corresponding to x-values (arrX) and y-values (arrY).

Parameters

arrX : Array

A set of x-values.

arrY : Array

A set of y-values.

Returns

linReg : Function

A function that takes a value or an array of values and calculates the corresponding linear regression values.

Errors

This function does not raise any errors.


numbers.statistic.mean(arr)

Calculates the mean of a set of values, arr.

Parameters

arr : Array

A set of values.

Returns

num : Number

The mean of arr.

Errors

This function does not raise any errors.


numbers.statistic.median(arr)

Calculates the median of a set of values, arr.

Parameters

arr : Array

A set of values.

Returns

num : Number

The median of arr.

Errors

This function does not raise any errors.


numbers.statistic.mode(arr)

Calculates the mode of a set of values, arr.

Parameters

arr : Array

A set of values.

Returns

num : Number

The mode of arr.

Errors

This function does not raise any errors.


numbers.statistic.quantile(arr, k, q)

Calculates the kth q-quantile of a set of values, arr.

Parameters

arr : Array

A set of values.

k : Number

Index of quantile.

q : Number

Number of quantiles.

Returns

num : Number

The median of arr.

Errors

This function does not raise any errors.


numbers.statistic.report(arr)

Creates a set of summary statistics of a set of values, arr. Calculates the mean, first quartile (mode), median, third quartile, and standard deviation.

Parameters

arr : Array

A set of values.

Returns

obj : Object

An object containing the mean ('mean'), first quartile ('firstQuartile'), median ('median'), third quartile ('thirdQuartile'), and standard deviation ('standardDev') of arr.

Errors

This function does not raise any errors.


numbers.statistic.rSquared(source, regression)

Calculates the coefficient of determination of a dataset, source, and a regression line, regression.

Parameters

source : Array

Data points.

regression : Array

Fitted points.

Returns

rSq : Number

The r-squared value of source, regression.arr.

Errors

This function does not raise any errors.


numbers.statistic.standardDev(arr)

Calculates the standard deviation of a set of values, arr.

Parameters

arr : Array

A set of values.

Returns

stddev : Number

The standard deviation of arr.

Errors

This function does not raise any errors.