Class Index | File Index

Classes


Namespace LABKEY.vis.Stat

The namespace used for statistics related functions.
Defined in: stat.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
<static>  
LABKEY.vis.Stat.median
An alias for LABKEY.vis.Stat.Q2
Method Summary
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.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.summary(data, accessor)
Calculates a statistical summary of an array of data.
Namespace Detail
LABKEY.vis.Stat
Field Detail
<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.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> {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

Documentation generated by JsDoc Toolkit 2.3.2 on Sat Dec 03 2016 18:27:34 GMT-0000 (UTC)