Class Statistics


  • public class Statistics
    extends Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Statistics()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double mad​(double[] values)
      Computes the mad statistic, that is the median of all distances to the median of input values.
      static double max​(double[] values)
      Computes the maximum value of an array of doubles.
      static float max​(float[] values)  
      static float max​(float[][] values)  
      static int max​(int[][] values)  
      static float max​(List<Float> values)  
      static int maxId​(int[] values)  
      static double mean​(double[] values)
      Computes the mean value of an array of doubles.
      static float mean​(float[] values)  
      static double median​(double[] values, boolean interpolated)
      Computes the median value of an array of doubles.
      static double min​(double[] values)
      Computes the minimum value of an array of doubles.
      static float min​(float[] values)  
      static float min​(float[][] values)  
      static int min​(int[][] values)  
      static float min​(List<Float> values)  
      static int minId​(double[] values)
      Returns the id where the minimal value stands.
      static int minId​(float[] values)  
      static int minId​(int[] values)  
      static Range minmax​(float[] values)  
      static double[] quantile​(double[] values, double[] levels)
      A convenient shortcut for: quantile(values, levels, true);
      static double[] quantile​(double[] values, double[] levels, boolean interpolated)
      Computes the quantiles of an array of doubles.
      static double std​(double[] values)
      Computes the standard deviation of an array of doubles.
      static double variance​(double[] values)
      Compute the variance of an array of doubles.
    • Constructor Detail

      • Statistics

        public Statistics()
    • Method Detail

      • mean

        public static double mean​(double[] values)
        Computes the mean value of an array of doubles. NaN values are ignored during the computation.
        Parameters:
        values -
        Returns:
        the mean value
      • mean

        public static float mean​(float[] values)
      • min

        public static float min​(List<Float> values)
      • min

        public static double min​(double[] values)
        Computes the minimum value of an array of doubles. NaN values are ignored during the computation.
        Parameters:
        values -
        Returns:
        the minimum value
      • min

        public static float min​(float[] values)
      • min

        public static float min​(float[][] values)
      • min

        public static int min​(int[][] values)
      • minId

        public static int minId​(double[] values)
        Returns the id where the minimal value stands.
      • minId

        public static int minId​(float[] values)
      • minId

        public static int minId​(int[] values)
      • max

        public static float max​(List<Float> values)
      • max

        public static double max​(double[] values)
        Computes the maximum value of an array of doubles. NaN values are ignored during the computation.
        Parameters:
        values -
        Returns:
        the maximum value
      • max

        public static float max​(float[] values)
      • max

        public static float max​(float[][] values)
      • max

        public static int max​(int[][] values)
      • maxId

        public static int maxId​(int[] values)
      • minmax

        public static Range minmax​(float[] values)
      • mad

        public static double mad​(double[] values)
        Computes the mad statistic, that is the median of all distances to the median of input values. If the input array is empty, the output value is Double.NaN
        Parameters:
        values -
        Returns:
      • std

        public static double std​(double[] values)
        Computes the standard deviation of an array of doubles. NaN values are ignored during the computation. If the input array is empty, the output value is Double.NaN
        Parameters:
        values -
        Returns:
        the standard deviation
      • variance

        public static double variance​(double[] values)
        Compute the variance of an array of doubles. variance(double[]) normalizes the output by N-1 if N>1, where N is the sample size. This is an unbiased estimator of the variance of the population For N=1, the output is 0.
        Parameters:
        values -
        Returns:
      • quantile

        public static double[] quantile​(double[] values,
                                        double[] levels,
                                        boolean interpolated)
        Computes the quantiles of an array of doubles. This method assumes the array has at least one element. NaN values are ignored during the computation.
        Parameters:
        values -
        levels - a list of levels that must belong to [0;100]
        interpolated - computes an interpolation of quantile when required quantile is not an exact vector id.
        Returns:
        the quantiles
        Throws:
        an - IllegalArgumentException if a level is out of the [0;100] bounds.
      • quantile

        public static double[] quantile​(double[] values,
                                        double[] levels)
        A convenient shortcut for: quantile(values, levels, true);
        Parameters:
        values -
        levels -
        Returns:
      • median

        public static double median​(double[] values,
                                    boolean interpolated)
        Computes the median value of an array of doubles.
        Parameters:
        values -
        interpolated -
        Returns:
        the mean value