Class Stats


  • public class Stats
    extends java.lang.Object
    Simple double statistics, computed incrementally, variance and standard deviation using Welford's online algorithm, see https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm
    Since:
    5.1.9
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private double avg  
      private double max  
      private double min  
      private int n  
      private double sum  
    • Constructor Summary

      Constructors 
      Constructor Description
      Stats()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(double x)
      Add a value
      double avg()  
      int count()  
      double max()  
      double min()  
      double stddev()  
      double var()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • n

        private int n
      • avg

        private double avg
      • min

        private double min
      • max

        private double max
      • sum

        private double sum
    • Constructor Detail

      • Stats

        public Stats()
    • Method Detail

      • add

        public void add​(double x)
        Add a value
        Parameters:
        x - value
      • count

        public int count()
        Returns:
        number of the added values
      • min

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

        public double max()
        Returns:
        maximum of the added values
      • avg

        public double avg()
        Returns:
        average of the added values
      • var

        public double var()
        Returns:
        variance of the added values
      • stddev

        public double stddev()
        Returns:
        standard deviation of the added values