Show:

ia.Statistics Class

Module: ia

Provides statistical information about an array of numbers (data).

Constructor

ia.Statistics

(
  • data
)

Parameters:

  • data Number

    An array of numbers.

Methods

_invalidateData

() private

Called when the data has been changed to recalculate statistics.

getData

(
  • the
)

Gets the data array.

Parameters:

  • the Number

    array.

getPercentile

(
  • percentile
  • a
)
Number

Returns the percentile at the given position in the dataset. Uses the sorted array.

Parameters:

  • percentile Number

    Valid values are 0 to 1.

    • Q1 (Lower Quartile): The 25th percentile (0.25).
      Q2 (Median): The 50th percentile (0.5).
      Q3 (Upper Quartile): The 75th percentile (0.75).
  • a Number

    The array of numbers to use - sorted or unique.

  • Returns:

    Number: The value of the given percentile or NaN if the percentile is outside the valid range (0 - 1).

    setData

    (
    • data
    )

    Sets the data array.

    Parameters:

    • data Number

      the array.

    statsToString

    () String

    Get a simple text representation of the main statistics.

    Returns:

    String: A text string.

    toString

    () String

    Get a simple text representation of this object.

    Returns:

    String: A text string.

    Properties

    interquartileRange

    Number

    The interquartile range.

    lowerQuartile

    Number

    The lower quartile.

    maxValue

    Number

    The maximum value.

    mean

    Number

    The average value of the dataset, i.e. the sum of all the data divided by the number of variables. The arithmetic mean is commonly called the "average". When the word "mean" is used without a modifier, it usually refers to the arithmetic mean.

    The mean is a good measure of central tendency for symmetrical (e.g. normal) distributions but can be misleading in skewed distributions since it is influenced by outliers. In general, the mean is larger than the median in positively skewed distributions and less than the median in negatively skewed distributions.

    Therefore, other statistics such as the median may be more informative for distributions that are frequently very skewed. The mean, median, and mode are equal in symmetrical frequency distributions. The mean is higher than the median in positively (right) skewed distributions and lower than the median in negatively (left) skewed distributions.

    median

    Number

    The middle value in the dataset, i.e. half the variables have values greater than the median and the other half values which are less. The median is less sensitive to outliers (extreme scores) than the mean and thus a better measure than the mean for highly skewed distributions.

    minValue

    Number

    The minimum value.

    mode

    Number

    The most frequently occurring value in the dataset. Easy to determine, but subject to variation and of limited value.

    modeCount

    Number

    The number of occurrences of the mode value

    modeString

    Number

    The difference between the largest and the smallest value in the dataset. Since the range only takes into account two values from the entire dataset, it may be heavily influenced by outliers in the data.

    modeString

    String

    The most frequently occurring value in the dataset. Easy to determine, but subject to variation and of limited value.

    sorted

    Number

    The data array sorted by numeric ascending, with none numeric values removed.

    standardDeviation

    Number

    The standard deviation for a population using the deviation score method. Standard Deviation is the average deviation of the scores from the mean.

    sum

    Number

    The sum.

    unique

    Number

    An array in which any duplicated values in the data array are removed.

    upperQuartile

    Number

    The upper quartile.

    variance

    Number

    The variance for a population using the deviation score method. Variance is the average squared deviation of the scores from the mean.