class pclStatsBox::DescriptiveStatistics

sys::Obj
  pclStatsBox::DescriptiveStatistics

DescriptiveStatistics computes statistics from a stored list of values.

This class is inspired by, but differs from, the Apache common's math class of the same name: https://commons.apache.org/proper/commons-math/

INFINITE_WINDOW

const static Int INFINITE_WINDOW := -1

Named constant to specify an infinite window.

addValue

Void addValue(Float value)

Adds a value to stored list.

clear

Void clear()

Removes all values from the stored list.

coefficientOfVariation

Float coefficientOfVariation()

The coefficient of variation is the ratio of the standard deviation to the mean, expressed as a percentage.

geometricMean

Float geometricMean()

The geometric mean represents the typical value of the stored list of values based on their product.

get

@Operator
Float get(Int index)

Returns the value at given index. Throws an IndexErr if index is out of range.

harmonicMean

Float harmonicMean()

The harmonic mean is an average formed from the reciprocal of the average of the reciprocals of the stored values. It gives less weight to the large values, and more to small values.

make

new make(Int windowSize := @INFINITE_WINDOW)

Constructs an instance ready to add values to. Provide an optional windowSize to restrict size to a finite limit.

makeFrom

new makeFrom(Float[] values, Int windowSize := @INFINITE_WINDOW)

Constructs an instance using the given set of values. Provide an optional windowSize to restrict size to a finite limit.

max

Float? max()

The largest value of the list of values, or null if the list is empty.

mean

Float mean()

The arithmetic mean of the list of values, or 0.0 if the list is empty.

median

Float median()

The median is the value separating the higher from the lower half of the list of values.

min

Float? min()

The smallest value of the list of values, or null if the list is empty.

percentile

Float percentile(Int p)

The percentile p is the value at which a percentage p of the list of values falls below.

populationStandardDeviation

Float populationStandardDeviation()

The population standard deviation measures the spread of the list of values. It is used when the values represent the entire population.

populationVariance

Float populationVariance()

The population variance measures the spread of the list of values from the mean. It is used when the values represent the entire population.

size

Int size()

The number of values in the stored list.

sortedValues

Float[] sortedValues()

Returns a copy of the stored list, in increasing order.

standardDeviation

Float standardDeviation()

The standard deviation measures the spread of the list of values. It is used when the values represent a sample from the entire population.

standardErrorOfMean

Float standardErrorOfMean()

The standard error the mean measures how much the mean of the sample varies from the mean of the population.

sum

Float sum()

The sum of every value in the stored list.

sumSquares

Float sumSquares()

The sum of the square of every value in the stored list.

variance

Float variance()

The variance measures the spread of the list of values from the mean. It is used when the values represent a sample from the entire population.

windowSize

Int windowSize { private set }

Holds maximum number of stored values, -1 for an infinite window.