Namespace LABKEY.vis.Stat
The namespace used for statistics related functions.
Defined in: stat.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
<static> |
LABKEY.vis.Stat.MEAN
An alias for LABKEY.vis.Stat.getMean
|
<static> |
LABKEY.vis.Stat.MEDIAN
An alias for LABKEY.vis.Stat.Q2
|
Method Attributes | Method Name and Description |
---|---|
<static> |
LABKEY.vis.Stat.fn(fn, n, min, max)
Executes a given function n times passing in values between min and max and returns an array of each result.
|
<static> |
LABKEY.vis.Stat.getCUSUM(values, negative, transform, forcePositiveResult, epsilon)
Calculates a variety of cumulative sums for a data array.
|
<static> |
LABKEY.vis.Stat.getMean(values)
Returns the average value.
|
<static> |
LABKEY.vis.Stat.getMovingRanges(values, forcePositiveResult, epsilon)
Calculate the moving range values for a data array, which are sequential differences between two successive values.
|
<static> |
LABKEY.vis.Stat.getStdDev(values)
Returns the standard deviation.
|
<static> |
LABKEY.vis.Stat.MAX(numbers)
Returns the maximum of the array.
|
<static> |
LABKEY.vis.Stat.MIN(numbers)
Returns the minimum of the array.
|
<static> |
LABKEY.vis.Stat.Q1(numbers)
Returns the 1st quartile for a sorted (asc) array.
|
<static> |
LABKEY.vis.Stat.Q2(numbers)
Returns the 2nd quartile (median) for a sorted (asc) array.
|
<static> |
LABKEY.vis.Stat.Q3(numbers)
Returns the 3rd quartile for a sorted (asc) array.
|
<static> |
LABKEY.vis.Stat.sortNumericAscending(data, accessor)
Sorts an array of data in ascending order.
|
<static> |
LABKEY.vis.Stat.sortNumericDescending(data, accessor)
Sorts an array of data in descending order.
|
<static> |
LABKEY.vis.Stat.SUM(numbers)
Returns the sum of the array.
|
<static> |
LABKEY.vis.Stat.summary(data, accessor)
Calculates a statistical summary of an array of data.
|
Field Detail
<static>
LABKEY.vis.Stat.MEAN
An alias for LABKEY.vis.Stat.getMean
<static>
LABKEY.vis.Stat.MEDIAN
An alias for LABKEY.vis.Stat.Q2
Method Detail
<static>
LABKEY.vis.Stat.fn(fn, n, min, max)
Executes a given function n times passing in values between min and max and returns an array of each result. Could
be used to generate data to plot a curve fit as part of a plot.
- Parameters:
- {Function} fn
- The function to be executed n times. The function must take one number as a parameter.
- {Number} n
- The number of times to execute fn.
- {Number} min
- The minimum value to pass to fn.
- {Number} max
- The maximum value to pass to fn.
<static>
{number[]}
LABKEY.vis.Stat.getCUSUM(values, negative, transform, forcePositiveResult, epsilon)
Calculates a variety of cumulative sums for a data array.
- Parameters:
- values
- Array of data values to calculate from
- negative
- True to calculate CUSUM-, false to calculate CUSUM+. (default to false)
- transform
- True to calculate CUSUMv (Variability CUSUM), false to calculate CUSUMm (Mean CUSUM). (default to false)
- forcePositiveResult
- True to force all result values to be no less than a specified positive value, usually used for log scale. (default to false)
- epsilon
- The smallest value that all returned value can be, only used if forcePositiveResult is true. (default to LABKEY.vis.Stat.CUSUM_EPSILON)
- Returns:
- {number[]}
<static>
{Number}
LABKEY.vis.Stat.getMean(values)
Returns the average value.
- Parameters:
- values
- An array of numbers.
- Returns:
- {Number}
<static>
{number[]}
LABKEY.vis.Stat.getMovingRanges(values, forcePositiveResult, epsilon)
Calculate the moving range values for a data array, which are sequential differences between two successive values.
- Parameters:
- values
- Array of data values to calculate from
- forcePositiveResult
- True to force all result values to be no less than a specified positive value, usually used for log scale. (default to false)
- epsilon
- The smallest value that all returned value can be, only used if forcePositiveResult is true. (default to LABKEY.vis.Stat.MOVING_RANGE_EPSILON)
- Returns:
- {number[]}
<static>
{Number}
LABKEY.vis.Stat.getStdDev(values)
Returns the standard deviation.
- Parameters:
- values
- An array of numbers.
- Returns:
- {Number}
<static>
{Number}
LABKEY.vis.Stat.MAX(numbers)
Returns the maximum of the array.
- Parameters:
- numbers
- An array of numbers.
- Returns:
- {Number}
<static>
{Number}
LABKEY.vis.Stat.MIN(numbers)
Returns the minimum of the array.
- Parameters:
- numbers
- An array of numbers.
- Returns:
- {Number}
<static>
{Number}
LABKEY.vis.Stat.Q1(numbers)
Returns the 1st quartile for a sorted (asc) array.
- Parameters:
- numbers
- An array of numbers.
- Returns:
- {Number}
<static>
{Number}
LABKEY.vis.Stat.Q2(numbers)
Returns the 2nd quartile (median) for a sorted (asc) array.
- Parameters:
- numbers
- An array of numbers.
- Returns:
- {Number}
<static>
{Number}
LABKEY.vis.Stat.Q3(numbers)
Returns the 3rd quartile for a sorted (asc) array.
- Parameters:
- numbers
- An array of numbers.
- Returns:
- {Number}
<static>
{Array}
LABKEY.vis.Stat.sortNumericAscending(data, accessor)
Sorts an array of data in ascending order. Removes null/undefined values.
- Parameters:
- {Array} data
- An array of objects that have numeric values.
- {Function} accessor
- A function used to access the numeric value that needs to be sorted.
- Returns:
- {Array}
<static>
{Array}
LABKEY.vis.Stat.sortNumericDescending(data, accessor)
Sorts an array of data in descending order. Removes null/undefined values.
- Parameters:
- {Array} data
- An array of objects that have numeric values.
- {Function} accessor
- A function used to access the numeric value that needs to be sorted.
- Returns:
- {Array}
<static>
{Number}
LABKEY.vis.Stat.SUM(numbers)
Returns the sum of the array.
- Parameters:
- numbers
- An array of numbers.
- Returns:
- {Number}
<static>
{Object}
LABKEY.vis.Stat.summary(data, accessor)
Calculates a statistical summary of an array of data. The summary includes Quartiles 1, 2, 3, minimum, maximum and
the inner quartile range. It is used internally to create box plots.
var data = [], accessor, summary; // Let's generate some data. for (var i = 0; i < 500; i++){ data.push(parseInt(Math.random() * 50)); } // Let's define how we access the data. accessor = function(row){ return row; } // Now we'll get a summary. summary = LABKEY.vis.Stat.summary(data, accessor); console.log(summary);
- Parameters:
- {Array} data
- An array of data. Can be an array of any type of object.
- {Function} accessor
- A function that is used to access the value of each item in the array.
- Returns:
- {Object} summary