Interface StatCore
access this type via: stats.StatCore (provides, requires or uses)
A collection of basic statistical functions.
Functions
dec min(dec values[])
dec max(dec values[])
dec mean(dec values[])
dec gmean(dec values[])
dec hmean(dec values[])
dec pmean(dec values[], dec p)
dec median(dec values[])
dec stdDev(dec values[])
dec stdErr(dec values[])
dec variance(dec values[])
dec covariance(dec x[], dec y[])
dec pearsoncc(dec x[], dec y[])
dec[] fiveNum(dec values[])
dec interquartileRange(dec values[])
dec[] getPercentiles(dec values[], dec percentiles[])
dec min(dec values[])
Returns the smallest value in the input array.
values Array from which to locate the value.
returns: The smallest value.
dec max(dec values[])
Returns the largest value in the input array.
values Array from which to locate the value.
returns: The largest value.
dec mean(dec values[])
Returns the arithmetic mean of the values in the input array.
values Array from which to calculate the mean.
returns: The arithmetic mean.
dec gmean(dec values[])
Returns the geometric mean of the values in the input array.
values Array from which to calculate the mean.
returns: The geometric mean.
dec hmean(dec values[])
Returns the harmonic mean of the values in the input array.
values Array from which to calculate the mean.
returns: The harmonic mean.
dec pmean(dec values[], dec p)
Returns the power (or generalised) mean of the values in the input array.
values Array from which to calculate the mean.
p The power to use for each value, and the root to use for the final average.
returns: The power mean.
dec median(dec values[])
Returns the median of the values in the input array. For an array with an odd number of values, this is the middle value; otherwise it's the arithmetic mean of the middle two values.
values Array from which to calculate the median.
returns: The median.
dec stdDev(dec values[])
Returns the standard deviation of the values in the input array.
values Array from which to calculate the standard deviation.
returns: The standard deviation.
dec stdErr(dec values[])
Returns the standard error of the values in the input array.
values Array from which to calculate the standard error.
returns: The standard error.
dec variance(dec values[])
Returns the variance of the values in the input array.
values Array from which to calculate the variance.
returns: The variance.
dec covariance(dec x[], dec y[])
Returns the covariance of the two sets of input values, which must be arrays of equal length.
x The first set of values.
y The second set of values.
returns: The covariance between the values in x and y.
dec pearsoncc(dec x[], dec y[])
Returns the Pearson correlation coefficient (a number between -1.0 and 1.0 inclusive) of the two sets of input values, which must be arrays of equal length.
x The first set of values.
y The second set of values.
returns: The Pearson correlation coefficient between the values in x and y.
dec[] fiveNum(dec values[])
Returns the five number summary of the values in the input array, also known as the quartiles and median. The quartiles are calculated using recursive application of a median operation. Q2 is equivalent to the overall median, and causes the array to be divided into two halves, above and below the median. The two halves then have a median calculated, which become Q1 and Q3. Min and max are equivalent to the values returned by the min() and max() functions in this interface.
values Array from which to calculate the summary.
returns: An array with [min, Q1, Q2, Q3, max].
dec interquartileRange(dec values[])
This is a utility function which is equivalent to the calculation Q3-Q1 using the result from fiveNum().
values Array from which to calculate the IQR.
returns: The interquartile range.
dec[] getPercentiles(dec values[], dec percentiles[])
Returns the requested percentiles of the values in the first input parameter. Midpoint interpolation is used if the percentiles do not exactly map to a number in the values array. Note that requesting the 0, 25, 50, 75 and 100 percentiles is a slightly different calculation to that used by fiveNum() because getPercentiles() does not split the array around the median (specifically, the 25 and 75 percentiles will be different to fiveNum()'s Q1 and Q3 if the input values array is of odd length).
values Array from which to calculate the percentiles.
percentiles The percentiles to calculate, in the range 0..100, where 10.0 is taken to mean ten percent.
returns: The requested percentiles.