Class SummaryStats

java.lang.Object
it.unimi.dsi.stat.SummaryStats
All Implemented Interfaces:
Size64

public class SummaryStats extends Object implements Size64
A simple class digesting a stream of numbers and providing basic statistics about the stream. You just have to create an instance, call add(double) or addAll(DoubleList) to add elements.

This class is thread-safe. All methods can be invoked concurrently.

Author:
Sebastiano Vigna
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(double x)
    Adds a value to the stream.
    void
    addAll(double[] a)
    Adds values to the stream.
    void
    Adds values to the stream.
    double
    max()
    Returns the maximum of the values added so far.
    double
    Returns the mean of the values added so far.
    double
    min()
    Returns the minimum of the values added so far.
    double
    Returns the relative standard deviation of the values added so far.
    double
    Returns the sample relative standard deviation of the values added so far.
    double
    Returns the sample standard deviation of the values added so far.
    double
    Returns the sample variance of the values added so far.
    int
    Deprecated.
    long
    Returns the number of values added so far.
    double
    Returns the standard deviation of the values added so far.
    double
    sum()
    Returns the sum of the values added so far.
     
    double
    Returns the variance of the values added so far.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SummaryStats

      public SummaryStats()
  • Method Details

    • add

      public void add(double x)
      Adds a value to the stream.
      Parameters:
      x - the new value.
    • addAll

      public void addAll(double[] a)
      Adds values to the stream.
      Parameters:
      a - an array of new values.
    • addAll

      public void addAll(DoubleList l)
      Adds values to the stream.
      Parameters:
      l - a list of new values.
    • mean

      public double mean()
      Returns the mean of the values added so far.
      Returns:
      the mean of the values added so far.
    • sum

      public double sum()
      Returns the sum of the values added so far.
      Returns:
      the sum of the values added so far.
    • sampleVariance

      public double sampleVariance()
      Returns the sample variance of the values added so far.
      Returns:
      the sample variance of the values added so far.
      See Also:
    • variance

      public double variance()
      Returns the variance of the values added so far.
      Returns:
      the variance of the values added so far.
      See Also:
    • sampleStandardDeviation

      public double sampleStandardDeviation()
      Returns the sample standard deviation of the values added so far.
      Returns:
      the sample standard deviation of the values added so far.
      See Also:
    • standardDeviation

      public double standardDeviation()
      Returns the standard deviation of the values added so far.
      Returns:
      the standard deviation of the values added so far.
      See Also:
    • sampleRelativeStandardDeviation

      public double sampleRelativeStandardDeviation()
      Returns the sample relative standard deviation of the values added so far.
      Returns:
      the sample relative standard deviation of the values added so far.
      See Also:
    • relativeStandardDeviation

      public double relativeStandardDeviation()
      Returns the relative standard deviation of the values added so far.
      Returns:
      the relative standard deviation of the values added so far.
      See Also:
    • min

      public double min()
      Returns the minimum of the values added so far.
      Returns:
      the minimum of the values added so far.
    • max

      public double max()
      Returns the maximum of the values added so far.
      Returns:
      the maximum of the values added so far.
    • size64

      public long size64()
      Returns the number of values added so far.
      Specified by:
      size64 in interface Size64
      Returns:
      the number of values added so far.
    • size

      @Deprecated public int size()
      Deprecated.
      Specified by:
      size in interface Size64
    • toString

      public String toString()
      Overrides:
      toString in class Object