Save This Page
Home » colt-1.2.0 » cern.jet.stat » [javadoc | source]
cern.jet.stat
public class: Descriptive [javadoc | source]
java.lang.Object
   cern.jet.stat.Descriptive
Basic descriptive statistics.
Constructor:
 protected Descriptive() 
Method from cern.jet.stat.Descriptive Summary:
autoCorrelation,   checkRangeFromTo,   correlation,   covariance,   durbinWatson,   frequencies,   geometricMean,   geometricMean,   harmonicMean,   incrementalUpdate,   incrementalUpdateSumsOfPowers,   incrementalWeightedUpdate,   kurtosis,   kurtosis,   lag1,   max,   mean,   meanDeviation,   median,   min,   moment,   moment,   pooledMean,   pooledVariance,   product,   product,   quantile,   quantileInverse,   quantiles,   rankInterpolated,   rms,   sampleKurtosis,   sampleKurtosis,   sampleKurtosisStandardError,   sampleSkew,   sampleSkew,   sampleSkewStandardError,   sampleStandardDeviation,   sampleVariance,   sampleVariance,   sampleWeightedVariance,   skew,   skew,   split,   standardDeviation,   standardError,   standardize,   sum,   sumOfInversions,   sumOfLogarithms,   sumOfPowerDeviations,   sumOfPowerDeviations,   sumOfPowers,   sumOfSquaredDeviations,   sumOfSquares,   trimmedMean,   variance,   variance,   weightedMean,   weightedRMS,   winsorizedMean
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from cern.jet.stat.Descriptive Detail:
 public static double autoCorrelation(DoubleArrayList data,
    int lag,
    double mean,
    double variance) 
    Returns the auto-correlation of a data sequence.
 protected static  void checkRangeFromTo(int from,
    int to,
    int theSize) 
    Checks if the given range is within the contained array's bounds.
 public static double correlation(DoubleArrayList data1,
    double standardDev1,
    DoubleArrayList data2,
    double standardDev2) 
    Returns the correlation of two data sequences. That is covariance(data1,data2)/(standardDev1*standardDev2).
 public static double covariance(DoubleArrayList data1,
    DoubleArrayList 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.
 public static double durbinWatson(DoubleArrayList data) 
    Durbin-Watson computation.
 public static  void frequencies(DoubleArrayList sortedData,
    DoubleArrayList 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)

 public static double geometricMean(DoubleArrayList 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()).
 public static double geometricMean(int size,
    double 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).
 public static double harmonicMean(int size,
    double sumOfInversions) 
    Returns the harmonic mean of a data sequence.
 public static  void incrementalUpdate(DoubleArrayList data,
    int from,
    int to,
    double[] 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. 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] ).

 public static  void incrementalUpdateSumsOfPowers(DoubleArrayList data,
    int from,
    int to,
    int fromSumIndex,
    int toSumIndex,
    double[] 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. 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 ).

 public static  void incrementalWeightedUpdate(DoubleArrayList data,
    DoubleArrayList weights,
    int from,
    int to,
    double[] 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. 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]).

 public static double kurtosis(double moment4,
    double standardDeviation) 
    Returns the kurtosis (aka excess) of a data sequence.
 public static double kurtosis(DoubleArrayList data,
    double mean,
    double standardDeviation) 
    Returns the kurtosis (aka excess) of a data sequence, which is -3 + moment(data,4,mean) / standardDeviation4.
 public static double lag1(DoubleArrayList data,
    double mean) 
    Returns the lag-1 autocorrelation of a dataset; Note that this method has semantics different from autoCorrelation(..., 1);
 public static double max(DoubleArrayList data) 
    Returns the largest member of a data sequence.
 public static double mean(DoubleArrayList data) 
    Returns the arithmetic mean of a data sequence; That is Sum( data[i] ) / data.size().
 public static double meanDeviation(DoubleArrayList data,
    double mean) 
    Returns the mean deviation of a dataset. That is Sum (Math.abs(data[i]-mean)) / data.size()).
 public static double median(DoubleArrayList sortedData) 
    Returns the median of a sorted data sequence.
 public static double min(DoubleArrayList data) 
    Returns the smallest member of a data sequence.
 public static double moment(DoubleArrayList data,
    int k,
    double c) 
    Returns the moment of k-th order with constant c of a data sequence, which is Sum( (data[i]-c)k ) / data.size().
 public static double moment(int k,
    double c,
    int size,
    double[] sumOfPowers) 
    Returns the moment of k-th order with constant c of a data sequence, which is Sum( (data[i]-c)k ) / data.size().
 public static double pooledMean(int size1,
    double mean1,
    int size2,
    double mean2) 
    Returns the pooled mean of two data sequences. That is (size1 * mean1 + size2 * mean2) / (size1 + size2).
 public static double pooledVariance(int size1,
    double variance1,
    int size2,
    double variance2) 
    Returns the pooled variance of two data sequences. That is (size1 * variance1 + size2 * variance2) / (size1 + size2);
 public static double product(DoubleArrayList 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.
 public static double product(int size,
    double 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()).
 public static double quantile(DoubleArrayList sortedData,
    double 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.
 public static double quantileInverse(DoubleArrayList sortedList,
    double 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.
 public static DoubleArrayList quantiles(DoubleArrayList sortedData,
    DoubleArrayList 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.
 public static double rankInterpolated(DoubleArrayList sortedList,
    double 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.
 public static double rms(int size,
    double 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.
 public static double sampleKurtosis(int size,
    double moment4,
    double 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.
 public static double sampleKurtosis(DoubleArrayList data,
    double mean,
    double sampleVariance) 
    Returns the sample kurtosis (aka excess) of a data sequence.
 public static double 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.
 public static double sampleSkew(int size,
    double moment3,
    double 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.
 public static double sampleSkew(DoubleArrayList data,
    double mean,
    double sampleVariance) 
    Returns the sample skew of a data sequence.
 public static double 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.
 public static double sampleStandardDeviation(int size,
    double 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.
 public static double sampleVariance(DoubleArrayList data,
    double mean) 
    Returns the sample variance of a data sequence. That is Sum ( (data[i]-mean)^2 ) / (data.size()-1).
 public static double sampleVariance(int size,
    double sum,
    double sumOfSquares) 
    Returns the sample variance of a data sequence. That is (sumOfSquares - mean*sum) / (size - 1) with mean = sum/size.
 public static double sampleWeightedVariance(double sumOfWeights,
    double sumOfProducts,
    double sumOfSquaredProducts) 
    Returns the sample weighted variance of a data sequence. That is (sumOfSquaredProducts - sumOfProducts * sumOfProducts / sumOfWeights) / (sumOfWeights - 1).
 public static double skew(double moment3,
    double standardDeviation) 
    Returns the skew of a data sequence.
 public static double skew(DoubleArrayList data,
    double mean,
    double standardDeviation) 
    Returns the skew of a data sequence, which is moment(data,3,mean) / standardDeviation3.
 public static DoubleArrayList[] split(DoubleArrayList sortedList,
    DoubleArrayList 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:

      data = (1,2,3,4,5,8,8,8,10,11).
      splitters=(2,8) yields 3 bins: (1), (2,3,4,5) (8,8,8,10,11).
      splitters=() yields 1 bin: (1,2,3,4,5,8,8,8,10,11).
      splitters=(-5) yields 2 bins: (), (1,2,3,4,5,8,8,8,10,11).
      splitters=(100) yields 2 bins: (1,2,3,4,5,8,8,8,10,11), ().
 public static double standardDeviation(double variance) 
    Returns the standard deviation from a variance.
 public static double standardError(int size,
    double variance) 
    Returns the standard error of a data sequence. That is Math.sqrt(variance/size).
 public static  void standardize(DoubleArrayList data,
    double mean,
    double standardDeviation) 
    Modifies a data sequence to be standardized. Changes each element data[i] as follows: data[i] = (data[i]-mean)/standardDeviation.
 public static double sum(DoubleArrayList data) 
    Returns the sum of a data sequence. That is Sum( data[i] ).
 public static double sumOfInversions(DoubleArrayList data,
    int from,
    int to) 
    Returns the sum of inversions of a data sequence, which is Sum( 1.0 / data[i]).
 public static double sumOfLogarithms(DoubleArrayList data,
    int from,
    int to) 
    Returns the sum of logarithms of a data sequence, which is Sum( Log(data[i]).
 public static double sumOfPowerDeviations(DoubleArrayList data,
    int k,
    double c) 
    Returns Sum( (data[i]-c)k ); optimized for common parameters like c == 0.0 and/or k == -2 .. 4.
 public static double sumOfPowerDeviations(DoubleArrayList data,
    int k,
    double 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.
 public static double sumOfPowers(DoubleArrayList data,
    int k) 
    Returns the sum of powers of a data sequence, which is Sum ( data[i]k ).
 public static double sumOfSquaredDeviations(int size,
    double variance) 
    Returns the sum of squared mean deviation of of a data sequence. That is variance * (size-1) == Sum( (data[i] - mean)^2 ).
 public static double sumOfSquares(DoubleArrayList data) 
    Returns the sum of squares of a data sequence. That is Sum ( data[i]*data[i] ).
 public static double trimmedMean(DoubleArrayList sortedData,
    double mean,
    int left,
    int right) 
    Returns the trimmed mean of a sorted data sequence.
 public static double variance(double standardDeviation) 
    Returns the variance from a standard deviation.
 public static double variance(int size,
    double sum,
    double sumOfSquares) 
    Returns the variance of a data sequence. That is (sumOfSquares - mean*sum) / size with mean = sum/size.
 public static double weightedMean(DoubleArrayList data,
    DoubleArrayList weights) 
    Returns the weighted mean of a data sequence. That is Sum (data[i] * weights[i]) / Sum ( weights[i] ).
 public static double weightedRMS(double sumOfProducts,
    double 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.
 public static double winsorizedMean(DoubleArrayList sortedData,
    double mean,
    int left,
    int right) 
    Returns the winsorized mean of a sorted data sequence.