|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpapaya.Descriptive.Mean
public static class Descriptive.Mean
Contains methods for computing the arithmetic, geometric, harmonic, trimmed, and winsorized means (among others).
Method Summary | |
---|---|
static float |
arithmetic(float[] data)
Returns the arithmetic mean of a data sequence; That is Sum( data[i] ) / data.length . |
static float[] |
columnMean(float[][] data)
Returns an array containing the arithmetic mean of each column of the input matrix. |
static float |
geometric(float[] data)
Returns the geometric mean of a data sequence. |
static float |
geometric(int size,
float sumOfLogarithms)
Returns the geometric mean of a data sequence. |
static float |
harmonic(float[] data)
Returns the harmonic mean of a data sequence as Sum( 1.0 / data[i]) . |
static float |
harmonic(int size,
float sumOfInversions)
Returns the harmonic mean of a data sequence. |
static float[] |
rowMean(float[][] data)
Returns an array containing the arithmetic mean of each row of the input matrix. |
static float |
trimmed(float[] sortedData,
float mean,
int left,
int right)
Returns the trimmed arithmetic mean of a sorted data sequence. |
static float |
winsorized(float[] sortedData,
float mean,
int left,
int right)
Returns the winsorized mean of a sorted data sequence. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static float[] columnMean(float[][] data)
public static float[] rowMean(float[][] data)
public static float arithmetic(float[] data)
Sum( data[i] ) / data.length
.
public static float geometric(int size, float sumOfLogarithms)
pow( Product( data[i] ), 1/size)
which is equivalent to Math.exp( Sum( Log(data[i]) ) / size)
.
public static float geometric(float[] data)
pow( Product( data[i] ), 1/data.size())
.
This method tries to avoid overflows at the expense of an equivalent but somewhat slow definition:
geometricMean = Math.exp( Sum( Log(data[i]) ) / size)
.
public static float harmonic(int size, float sumOfInversions)
size
- the number of elements in the data sequence.sumOfInversions
- Sum( 1.0 / data[i])
.public static float harmonic(float[] data)
Sum( 1.0 / data[i])
.
data
- arraypublic static float trimmed(float[] sortedData, float mean, int left, int right)
sortedData
- the data sequence; must be sorted ascending.mean
- the mean of the (full) sorted data sequence.left
- the number of leading elements to trim.right
- the number of trailing elements to trim.public static float winsorized(float[] sortedData, float mean, int left, int right)
sortedData
- the data sequence; must be sorted ascending.mean
- the mean of the (full) sorted data sequence.left
- the number of leading elements to trim.right
- the number of trailing elements to trim.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |