Parallel Colt 0.7.2

cern.jet.stat.tfloat
Class FloatDescriptive

java.lang.Object
  extended by cern.jet.stat.tfloat.FloatDescriptive

public class FloatDescriptive
extends Object

Basic descriptive statistics.

Version:
0.91, 08-Dec-99
Author:
peter.gedeck@pharma.Novartis.com, wolfgang.hoschek@cern.ch

Method Summary
static float autoCorrelation(FloatArrayList data, int lag, float mean, float variance)
          Returns the auto-correlation of a data sequence.
static float correlation(FloatArrayList data1, float standardDev1, FloatArrayList data2, float standardDev2)
          Returns the correlation of two data sequences.
static float covariance(FloatArrayList data1, FloatArrayList data2)
          Returns the covariance of two data sequences, which is cov(x,y) = (1/(size()-1)) * Sum((x[i]-mean(x)) * (y[i]-mean(y))) .
static float durbinWatson(FloatArrayList data)
          Durbin-Watson computation.
static void frequencies(FloatArrayList sortedData, FloatArrayList distinctValues, IntArrayList frequencies)
          Computes the frequency (number of occurances, count) of each distinct value in the given sorted data.
static float geometricMean(FloatArrayList data)
          Returns the geometric mean of a data sequence.
static float geometricMean(int size, float sumOfLogarithms)
          Returns the geometric mean of a data sequence.
static float harmonicMean(int size, float sumOfInversions)
          Returns the harmonic mean of a data sequence.
static void incrementalUpdate(FloatArrayList data, int from, int to, float[] inOut)
          Incrementally maintains and updates minimum, maximum, sum and sum of squares of a data sequence.
static void incrementalUpdateSumsOfPowers(FloatArrayList data, int from, int to, int fromSumIndex, int toSumIndex, float[] sumOfPowers)
          Incrementally maintains and updates various sums of powers of the form Sum(data[i]k).
static void incrementalWeightedUpdate(FloatArrayList data, FloatArrayList weights, int from, int to, float[] inOut)
          Incrementally maintains and updates sum and sum of squares of a weighted data sequence.
static float kurtosis(FloatArrayList data, float mean, float standardDeviation)
          Returns the kurtosis (aka excess) of a data sequence, which is -3 + moment(data,4,mean) / standardDeviation4.
static float kurtosis(float moment4, float standardDeviation)
          Returns the kurtosis (aka excess) of a data sequence.
static float lag1(FloatArrayList data, float mean)
          Returns the lag-1 autocorrelation of a dataset; Note that this method has semantics different from autoCorrelation(..., 1);
static float max(FloatArrayList data)
          Returns the largest member of a data sequence.
static float mean(FloatArrayList data)
          Returns the arithmetic mean of a data sequence; That is Sum( data[i] ) / data.size().
static float meanDeviation(FloatArrayList data, float mean)
          Returns the mean deviation of a dataset.
static float median(FloatArrayList sortedData)
          Returns the median of a sorted data sequence.
static float min(FloatArrayList data)
          Returns the smallest member of a data sequence.
static float moment(FloatArrayList data, int k, float c)
          Returns the moment of k-th order with constant c of a data sequence, which is Sum( (data[i]-c)k ) / data.size().
static float moment(int k, float c, int size, float[] sumOfPowers)
          Returns the moment of k-th order with constant c of a data sequence, which is Sum( (data[i]-c)k ) / data.size().
static float pooledMean(int size1, float mean1, int size2, float mean2)
          Returns the pooled mean of two data sequences.
static float pooledVariance(int size1, float variance1, int size2, float variance2)
          Returns the pooled variance of two data sequences.
static float product(FloatArrayList data)
          Returns the product of a data sequence, which is Prod( data[i] ) .
static float product(int size, float sumOfLogarithms)
          Returns the product, which is Prod( data[i] ).
static float quantile(FloatArrayList sortedData, float phi)
          Returns the phi-quantile; that is, an element elem for which holds that phi percent of data elements are less than elem.
static float quantileInverse(FloatArrayList sortedList, float element)
          Returns how many percent of the elements contained in the receiver are <= element.
static FloatArrayList quantiles(FloatArrayList sortedData, FloatArrayList percentages)
          Returns the quantiles of the specified percentages.
static float rankInterpolated(FloatArrayList sortedList, float element)
          Returns the linearly interpolated number of elements in a list less or equal to a given element.
static float rms(int size, float sumOfSquares)
          Returns the RMS (Root-Mean-Square) of a data sequence.
static float sampleKurtosis(FloatArrayList data, float mean, float sampleVariance)
          Returns the sample kurtosis (aka excess) of a data sequence.
static float sampleKurtosis(int size, float moment4, float sampleVariance)
          Returns the sample kurtosis (aka excess) of a data sequence.
static float sampleKurtosisStandardError(int size)
          Return the standard error of the sample kurtosis.
static float sampleSkew(FloatArrayList data, float mean, float sampleVariance)
          Returns the sample skew of a data sequence.
static float sampleSkew(int size, float moment3, float sampleVariance)
          Returns the sample skew of a data sequence.
static float sampleSkewStandardError(int size)
          Return the standard error of the sample skew.
static float sampleStandardDeviation(int size, float sampleVariance)
          Returns the sample standard deviation.
static float sampleVariance(FloatArrayList data, float mean)
          Returns the sample variance of a data sequence.
static float sampleVariance(int size, float sum, float sumOfSquares)
          Returns the sample variance of a data sequence.
static float sampleWeightedVariance(float sumOfWeights, float sumOfProducts, float sumOfSquaredProducts)
          Returns the sample weighted variance of a data sequence.
static float skew(FloatArrayList data, float mean, float standardDeviation)
          Returns the skew of a data sequence, which is moment(data,3,mean) / standardDeviation3.
static float skew(float moment3, float standardDeviation)
          Returns the skew of a data sequence.
static FloatArrayList[] split(FloatArrayList sortedList, FloatArrayList splitters)
          Splits (partitions) a list into sublists such that each sublist contains the elements with a given range.
static float standardDeviation(float variance)
          Returns the standard deviation from a variance.
static float standardError(int size, float variance)
          Returns the standard error of a data sequence.
static void standardize(FloatArrayList data, float mean, float standardDeviation)
          Modifies a data sequence to be standardized.
static float sum(FloatArrayList data)
          Returns the sum of a data sequence.
static float sumOfInversions(FloatArrayList data, int from, int to)
          Returns the sum of inversions of a data sequence, which is Sum( 1.0 / data[i]).
static float sumOfLogarithms(FloatArrayList data, int from, int to)
          Returns the sum of logarithms of a data sequence, which is Sum( Log(data[i]).
static float sumOfPowerDeviations(FloatArrayList data, int k, float c)
          Returns Sum( (data[i]-c)k ); optimized for common parameters like c == 0.0 and/or k == -2 ..
static float sumOfPowerDeviations(FloatArrayList data, int k, float c, int from, int to)
          Returns Sum( (data[i]-c)k ) for all i = from ..
static float sumOfPowers(FloatArrayList data, int k)
          Returns the sum of powers of a data sequence, which is Sum ( data[i]k ).
static float sumOfSquaredDeviations(int size, float variance)
          Returns the sum of squared mean deviation of of a data sequence.
static float sumOfSquares(FloatArrayList data)
          Returns the sum of squares of a data sequence.
static float trimmedMean(FloatArrayList sortedData, float mean, int left, int right)
          Returns the trimmed mean of a sorted data sequence.
static float variance(float standardDeviation)
          Returns the variance from a standard deviation.
static float variance(int size, float sum, float sumOfSquares)
          Returns the variance of a data sequence.
static float weightedMean(FloatArrayList data, FloatArrayList weights)
          Returns the weighted mean of a data sequence.
static float weightedRMS(float sumOfProducts, float sumOfSquaredProducts)
          Returns the weighted RMS (Root-Mean-Square) of a data sequence.
static float winsorizedMean(FloatArrayList 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

autoCorrelation

public static float autoCorrelation(FloatArrayList data,
                                    int lag,
                                    float mean,
                                    float variance)
Returns the auto-correlation of a data sequence.


correlation

public static float correlation(FloatArrayList data1,
                                float standardDev1,
                                FloatArrayList data2,
                                float standardDev2)
Returns the correlation of two data sequences. That is covariance(data1,data2)/(standardDev1*standardDev2).


covariance

public static float covariance(FloatArrayList data1,
                               FloatArrayList data2)
Returns the covariance of two data sequences, which is cov(x,y) = (1/(size()-1)) * Sum((x[i]-mean(x)) * (y[i]-mean(y))) . See the math definition.


durbinWatson

public static float durbinWatson(FloatArrayList data)
Durbin-Watson computation.


frequencies

public static void frequencies(FloatArrayList sortedData,
                               FloatArrayList distinctValues,
                               IntArrayList frequencies)
Computes the frequency (number of occurances, count) of each distinct value in the given sorted data. After this call returns both distinctValues and frequencies have a new size (which is equal for both), which is the number of distinct values in the sorted data.

Distinct values are filled into distinctValues, starting at index 0. The frequency of each distinct value is filled into frequencies, starting at index 0. As a result, the smallest distinct value (and its frequency) can be found at index 0, the second smallest distinct value (and its frequency) at index 1, ..., the largest distinct value (and its frequency) at index distinctValues.size()-1. Example:
elements = (5,6,6,7,8,8) --> distinctValues = (5,6,7,8), frequencies = (1,2,1,2)

Parameters:
sortedData - the data; must be sorted ascending.
distinctValues - a list to be filled with the distinct values; can have any size.
frequencies - a list to be filled with the frequencies; can have any size; set this parameter to null to ignore it.

geometricMean

public static float geometricMean(int size,
                                  float sumOfLogarithms)
Returns the geometric mean of a data sequence. Note that for a geometric mean to be meaningful, the minimum of the data sequence must not be less or equal to zero.
The geometric mean is given by pow( Product( data[i] ), 1/size) which is equivalent to Math.exp( Sum( Log(data[i]) ) / size).


geometricMean

public static float geometricMean(FloatArrayList data)
Returns the geometric mean of a data sequence. Note that for a geometric mean to be meaningful, the minimum of the data sequence must not be less or equal to zero.
The geometric mean is given by pow( Product( data[i] ), 1/data.size()). This method tries to avoid overflows at the expense of an equivalent but somewhat slow definition: geo = Math.exp( Sum( Log(data[i]) ) / data.size()).


harmonicMean

public static float harmonicMean(int size,
                                 float sumOfInversions)
Returns the harmonic mean of a data sequence.

Parameters:
size - the number of elements in the data sequence.
sumOfInversions - Sum( 1.0 / data[i]).

incrementalUpdate

public static void incrementalUpdate(FloatArrayList data,
                                     int from,
                                     int to,
                                     float[] inOut)
Incrementally maintains and updates minimum, maximum, sum and sum of squares of a data sequence. Assume we have already recorded some data sequence elements and know their minimum, maximum, sum and sum of squares. Assume further, we are to record some more elements and to derive updated values of minimum, maximum, sum and sum of squares.

This method computes those updated values without needing to know the already recorded elements. Returns the updated values filled into the inOut array. This is interesting for interactive online monitoring and/or applications that cannot keep the entire huge data sequence in memory.


Definition of sumOfSquares: sumOfSquares(n) = Sum ( data[i] * data[i] ).

Parameters:
data - the additional elements to be incorporated into min, max, etc.
from - the index of the first element within data to consider.
to - the index of the last element within data to consider. The method incorporates elements data[from], ..., data[to].
inOut - the old values in the following format:
  • inOut[0] is the old minimum.
  • inOut[1] is the old maximum.
  • inOut[2] is the old sum.
  • inOut[3] is the old sum of squares.
If no data sequence elements have so far been recorded set the values as follows
  • inOut[0] = Float.POSITIVE_INFINITY as the old minimum.
  • inOut[1] = Float.NEGATIVE_INFINITY as the old maximum.
  • inOut[2] = 0.0 as the old sum.
  • inOut[3] = 0.0 as the old sum of squares.

incrementalUpdateSumsOfPowers

public static void incrementalUpdateSumsOfPowers(FloatArrayList data,
                                                 int from,
                                                 int to,
                                                 int fromSumIndex,
                                                 int toSumIndex,
                                                 float[] sumOfPowers)
Incrementally maintains and updates various sums of powers of the form Sum(data[i]k). Assume we have already recorded some data sequence elements data[i] and know the values of Sum(data[i]from), Sum(data[i]from+1), ..., Sum(data[i]to) . Assume further, we are to record some more elements and to derive updated values of these sums.

This method computes those updated values without needing to know the already recorded elements. Returns the updated values filled into the sumOfPowers array. This is interesting for interactive online monitoring and/or applications that cannot keep the entire huge data sequence in memory. For example, the incremental computation of moments is based upon such sums of powers:

The moment of k-th order with constant c of a data sequence, is given by Sum( (data[i]-c)k ) / data.size(). It can incrementally be computed by using the equivalent formula

moment(k,c) = m(k,c) / data.size() where
m(k,c) = Sum( -1i * b(k,i) * ci * sumOfPowers(k-i)) for i = 0 .. k and
b(k,i) = binomial(k,i) and
sumOfPowers(k) = Sum( data[i]k ).

Parameters:
data - the additional elements to be incorporated into min, max, etc.
from - the index of the first element within data to consider.
to - the index of the last element within data to consider. The method incorporates elements data[from], ..., data[to].
sumOfPowers - the old values of the sums in the following format:
  • sumOfPowers[0] is the old Sum(data[i]fromSumIndex).
  • sumOfPowers[1] is the old Sum(data[i]fromSumIndex+1).
  • ...
  • sumOfPowers[toSumIndex-fromSumIndex] is the old Sum(data[i]toSumIndex).
If no data sequence elements have so far been recorded set all old values of the sums to 0.0.

incrementalWeightedUpdate

public static void incrementalWeightedUpdate(FloatArrayList data,
                                             FloatArrayList weights,
                                             int from,
                                             int to,
                                             float[] inOut)
Incrementally maintains and updates sum and sum of squares of a weighted data sequence. Assume we have already recorded some data sequence elements and know their sum and sum of squares. Assume further, we are to record some more elements and to derive updated values of sum and sum of squares.

This method computes those updated values without needing to know the already recorded elements. Returns the updated values filled into the inOut array. This is interesting for interactive online monitoring and/or applications that cannot keep the entire huge data sequence in memory.


Definition of sum: sum = Sum ( data[i] * weights[i] ).
Definition of sumOfSquares: sumOfSquares = Sum ( data[i] * data[i] * weights[i]).

Parameters:
data - the additional elements to be incorporated into min, max, etc.
weights - the weight of each element within data.
from - the index of the first element within data (and weights) to consider.
to - the index of the last element within data (and weights) to consider. The method incorporates elements data[from], ..., data[to].
inOut - the old values in the following format:
  • inOut[0] is the old sum.
  • inOut[1] is the old sum of squares.
If no data sequence elements have so far been recorded set the values as follows
  • inOut[0] = 0.0 as the old sum.
  • inOut[1] = 0.0 as the old sum of squares.

kurtosis

public static float kurtosis(float moment4,
                             float standardDeviation)
Returns the kurtosis (aka excess) of a data sequence.

Parameters:
moment4 - the fourth central moment, which is moment(data,4,mean).
standardDeviation - the standardDeviation.

kurtosis

public static float kurtosis(FloatArrayList data,
                             float mean,
                             float standardDeviation)
Returns the kurtosis (aka excess) of a data sequence, which is -3 + moment(data,4,mean) / standardDeviation4.


lag1

public static float lag1(FloatArrayList data,
                         float mean)
Returns the lag-1 autocorrelation of a dataset; Note that this method has semantics different from autoCorrelation(..., 1);


max

public static float max(FloatArrayList data)
Returns the largest member of a data sequence.


mean

public static float mean(FloatArrayList data)
Returns the arithmetic mean of a data sequence; That is Sum( data[i] ) / data.size().


meanDeviation

public static float meanDeviation(FloatArrayList data,
                                  float mean)
Returns the mean deviation of a dataset. That is Sum (Math.abs(data[i]-mean)) / data.size()).


median

public static float median(FloatArrayList sortedData)
Returns the median of a sorted data sequence.

Parameters:
sortedData - the data sequence; must be sorted ascending.

min

public static float min(FloatArrayList data)
Returns the smallest member of a data sequence.


moment

public static float moment(int k,
                           float c,
                           int size,
                           float[] sumOfPowers)
Returns the moment of k-th order with constant c of a data sequence, which is Sum( (data[i]-c)k ) / data.size().

Parameters:
sumOfPowers - sumOfPowers[m] == Sum( data[i]m) ) for m = 0,1,..,k as returned by method incrementalUpdateSumsOfPowers(FloatArrayList,int,int,int,int,float[]) . In particular there must hold sumOfPowers.length == k+1.
size - the number of elements of the data sequence.

moment

public static float moment(FloatArrayList data,
                           int k,
                           float c)
Returns the moment of k-th order with constant c of a data sequence, which is Sum( (data[i]-c)k ) / data.size().


pooledMean

public static float pooledMean(int size1,
                               float mean1,
                               int size2,
                               float mean2)
Returns the pooled mean of two data sequences. That is (size1 * mean1 + size2 * mean2) / (size1 + size2).

Parameters:
size1 - the number of elements in data sequence 1.
mean1 - the mean of data sequence 1.
size2 - the number of elements in data sequence 2.
mean2 - the mean of data sequence 2.

pooledVariance

public static float pooledVariance(int size1,
                                   float variance1,
                                   int size2,
                                   float variance2)
Returns the pooled variance of two data sequences. That is (size1 * variance1 + size2 * variance2) / (size1 + size2);

Parameters:
size1 - the number of elements in data sequence 1.
variance1 - the variance of data sequence 1.
size2 - the number of elements in data sequence 2.
variance2 - the variance of data sequence 2.

product

public static float product(int size,
                            float sumOfLogarithms)
Returns the product, which is Prod( data[i] ). In other words: data[0]*data[1]*...*data[data.size()-1]. This method uses the equivalent definition: prod = pow( exp( Sum( Log(x[i]) ) / size(), size()).


product

public static float product(FloatArrayList data)
Returns the product of a data sequence, which is Prod( data[i] ) . In other words: data[0]*data[1]*...*data[data.size()-1]. Note that you may easily get numeric overflows.


quantile

public static float quantile(FloatArrayList sortedData,
                             float phi)
Returns the phi-quantile; that is, an element elem for which holds that phi percent of data elements are less than elem. The quantile need not necessarily be contained in the data sequence, it can be a linear interpolation.

Parameters:
sortedData - the data sequence; must be sorted ascending.
phi - the percentage; must satisfy 0 <= phi <= 1.

quantileInverse

public static float quantileInverse(FloatArrayList sortedList,
                                    float element)
Returns how many percent of the elements contained in the receiver are <= element. Does linear interpolation if the element is not contained but lies in between two contained elements.

Parameters:
sortedList - the list to be searched (must be sorted ascending).
element - the element to search for.
Returns:
the percentage phi of elements <= element ( 0.0 <= phi <= 1.0).

quantiles

public static FloatArrayList quantiles(FloatArrayList sortedData,
                                       FloatArrayList percentages)
Returns the quantiles of the specified percentages. The quantiles need not necessarily be contained in the data sequence, it can be a linear interpolation.

Parameters:
sortedData - the data sequence; must be sorted ascending.
percentages - the percentages for which quantiles are to be computed. Each percentage must be in the interval [0.0,1.0].
Returns:
the quantiles.

rankInterpolated

public static float rankInterpolated(FloatArrayList sortedList,
                                     float element)
Returns the linearly interpolated number of elements in a list less or equal to a given element. The rank is the number of elements <= element. Ranks are of the form {0, 1, 2,..., sortedList.size()}. If no element is <= element, then the rank is zero. If the element lies in between two contained elements, then linear interpolation is used and a non integer value is returned.

Parameters:
sortedList - the list to be searched (must be sorted ascending).
element - the element to search for.
Returns:
the rank of the element.

rms

public static float rms(int size,
                        float sumOfSquares)
Returns the RMS (Root-Mean-Square) of a data sequence. That is Math.sqrt(Sum( data[i]*data[i] ) / data.size()). The RMS of data sequence is the square-root of the mean of the squares of the elements in the data sequence. It is a measure of the average "size" of the elements of a data sequence.

Parameters:
sumOfSquares - sumOfSquares(data) == Sum( data[i]*data[i] ) of the data sequence.
size - the number of elements in the data sequence.

sampleKurtosis

public static float sampleKurtosis(int size,
                                   float moment4,
                                   float sampleVariance)
Returns the sample kurtosis (aka excess) of a data sequence. Ref: R.R. Sokal, F.J. Rohlf, Biometry: the principles and practice of statistics in biological research (W.H. Freeman and Company, New York, 1998, 3rd edition) p. 114-115.

Parameters:
size - the number of elements of the data sequence.
moment4 - the fourth central moment, which is moment(data,4,mean).
sampleVariance - the sample variance.

sampleKurtosis

public static float sampleKurtosis(FloatArrayList data,
                                   float mean,
                                   float sampleVariance)
Returns the sample kurtosis (aka excess) of a data sequence.


sampleKurtosisStandardError

public static float sampleKurtosisStandardError(int size)
Return the standard error of the sample kurtosis. Ref: R.R. Sokal, F.J. Rohlf, Biometry: the principles and practice of statistics in biological research (W.H. Freeman and Company, New York, 1998, 3rd edition) p. 138.

Parameters:
size - the number of elements of the data sequence.

sampleSkew

public static float sampleSkew(int size,
                               float moment3,
                               float sampleVariance)
Returns the sample skew of a data sequence. Ref: R.R. Sokal, F.J. Rohlf, Biometry: the principles and practice of statistics in biological research (W.H. Freeman and Company, New York, 1998, 3rd edition) p. 114-115.

Parameters:
size - the number of elements of the data sequence.
moment3 - the third central moment, which is moment(data,3,mean).
sampleVariance - the sample variance.

sampleSkew

public static float sampleSkew(FloatArrayList data,
                               float mean,
                               float sampleVariance)
Returns the sample skew of a data sequence.


sampleSkewStandardError

public static float sampleSkewStandardError(int size)
Return the standard error of the sample skew. Ref: R.R. Sokal, F.J. Rohlf, Biometry: the principles and practice of statistics in biological research (W.H. Freeman and Company, New York, 1998, 3rd edition) p. 138.

Parameters:
size - the number of elements of the data sequence.

sampleStandardDeviation

public static float sampleStandardDeviation(int size,
                                            float sampleVariance)
Returns the sample standard deviation. Ref: R.R. Sokal, F.J. Rohlf, Biometry: the principles and practice of statistics in biological research (W.H. Freeman and Company, New York, 1998, 3rd edition) p. 53.

Parameters:
size - the number of elements of the data sequence.
sampleVariance - the sample variance.

sampleVariance

public static float sampleVariance(int size,
                                   float sum,
                                   float sumOfSquares)
Returns the sample variance of a data sequence. That is (sumOfSquares - mean*sum) / (size - 1) with mean = sum/size.

Parameters:
size - the number of elements of the data sequence.
sum - == Sum( data[i] ).
sumOfSquares - == Sum( data[i]*data[i] ).

sampleVariance

public static float sampleVariance(FloatArrayList data,
                                   float mean)
Returns the sample variance of a data sequence. That is Sum ( (data[i]-mean)^2 ) / (data.size()-1).


sampleWeightedVariance

public static float sampleWeightedVariance(float sumOfWeights,
                                           float sumOfProducts,
                                           float sumOfSquaredProducts)
Returns the sample weighted variance of a data sequence. That is (sumOfSquaredProducts - sumOfProducts * sumOfProducts / sumOfWeights) / (sumOfWeights - 1) .

Parameters:
sumOfWeights - == Sum( weights[i] ).
sumOfProducts - == Sum( data[i] * weights[i] ).
sumOfSquaredProducts - == Sum( data[i] * data[i] * weights[i] ).

skew

public static float skew(float moment3,
                         float standardDeviation)
Returns the skew of a data sequence.

Parameters:
moment3 - the third central moment, which is moment(data,3,mean).
standardDeviation - the standardDeviation.

skew

public static float skew(FloatArrayList data,
                         float mean,
                         float standardDeviation)
Returns the skew of a data sequence, which is moment(data,3,mean) / standardDeviation3.


split

public static FloatArrayList[] split(FloatArrayList sortedList,
                                     FloatArrayList splitters)
Splits (partitions) a list into sublists such that each sublist contains the elements with a given range. splitters=(a,b,c,...,y,z) defines the ranges [-inf,a), [a,b), [b,c), ..., [y,z), [z,inf].

Examples:

Parameters:
sortedList - the list to be partitioned (must be sorted ascending).
splitters - the points at which the list shall be partitioned (must be sorted ascending).
Returns:
the sublists (an array with length == splitters.size() + 1. Each sublist is returned sorted ascending.

standardDeviation

public static float standardDeviation(float variance)
Returns the standard deviation from a variance.


standardError

public static float standardError(int size,
                                  float variance)
Returns the standard error of a data sequence. That is Math.sqrt(variance/size).

Parameters:
size - the number of elements in the data sequence.
variance - the variance of the data sequence.

standardize

public static void standardize(FloatArrayList data,
                               float mean,
                               float standardDeviation)
Modifies a data sequence to be standardized. Changes each element data[i] as follows: data[i] = (data[i]-mean)/standardDeviation.


sum

public static float sum(FloatArrayList data)
Returns the sum of a data sequence. That is Sum( data[i] ).


sumOfInversions

public static float sumOfInversions(FloatArrayList data,
                                    int from,
                                    int to)
Returns the sum of inversions of a data sequence, which is Sum( 1.0 / data[i]).

Parameters:
data - the data sequence.
from - the index of the first data element (inclusive).
to - the index of the last data element (inclusive).

sumOfLogarithms

public static float sumOfLogarithms(FloatArrayList data,
                                    int from,
                                    int to)
Returns the sum of logarithms of a data sequence, which is Sum( Log(data[i]).

Parameters:
data - the data sequence.
from - the index of the first data element (inclusive).
to - the index of the last data element (inclusive).

sumOfPowerDeviations

public static float sumOfPowerDeviations(FloatArrayList data,
                                         int k,
                                         float c)
Returns Sum( (data[i]-c)k ); optimized for common parameters like c == 0.0 and/or k == -2 .. 4.


sumOfPowerDeviations

public static float sumOfPowerDeviations(FloatArrayList data,
                                         int k,
                                         float c,
                                         int from,
                                         int to)
Returns Sum( (data[i]-c)k ) for all i = from .. to; optimized for common parameters like c == 0.0 and/or k == -2 .. 5.


sumOfPowers

public static float sumOfPowers(FloatArrayList data,
                                int k)
Returns the sum of powers of a data sequence, which is Sum ( data[i]k ).


sumOfSquaredDeviations

public static float sumOfSquaredDeviations(int size,
                                           float variance)
Returns the sum of squared mean deviation of of a data sequence. That is variance * (size-1) == Sum( (data[i] - mean)^2 ).

Parameters:
size - the number of elements of the data sequence.
variance - the variance of the data sequence.

sumOfSquares

public static float sumOfSquares(FloatArrayList data)
Returns the sum of squares of a data sequence. That is Sum ( data[i]*data[i] ).


trimmedMean

public static float trimmedMean(FloatArrayList sortedData,
                                float mean,
                                int left,
                                int right)
Returns the trimmed mean of a sorted data sequence.

Parameters:
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.

variance

public static float variance(float standardDeviation)
Returns the variance from a standard deviation.


variance

public static float variance(int size,
                             float sum,
                             float sumOfSquares)
Returns the variance of a data sequence. That is (sumOfSquares - mean*sum) / size with mean = sum/size.

Parameters:
size - the number of elements of the data sequence.
sum - == Sum( data[i] ).
sumOfSquares - == Sum( data[i]*data[i] ).

weightedMean

public static float weightedMean(FloatArrayList data,
                                 FloatArrayList weights)
Returns the weighted mean of a data sequence. That is Sum (data[i] * weights[i]) / Sum ( weights[i] ).


weightedRMS

public static float weightedRMS(float sumOfProducts,
                                float sumOfSquaredProducts)
Returns the weighted RMS (Root-Mean-Square) of a data sequence. That is Sum( data[i] * data[i] * weights[i]) / Sum( data[i] * weights[i] ) , or in other words sumOfProducts / sumOfSquaredProducts.

Parameters:
sumOfProducts - == Sum( data[i] * weights[i] ).
sumOfSquaredProducts - == Sum( data[i] * data[i] * weights[i] ).

winsorizedMean

public static float winsorizedMean(FloatArrayList sortedData,
                                   float mean,
                                   int left,
                                   int right)
Returns the winsorized mean of a sorted data sequence.

Parameters:
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.

Parallel Colt 0.7.2

Jump to the Parallel Colt Homepage