Class StatisticalUtils

java.lang.Object
software.bluelib.utils.math.StatisticalUtils

public class StatisticalUtils extends Object
A class for performing various statistical calculations on arrays of double values.

This class includes methods to compute key statistical metrics such as mean, median, mode, standard deviation, variance, range, and coefficient of variation. Each method logs appropriate messages for success or warnings when the input array is empty.

Key Methods:

Each method logs a success message with the computed value or a warning if the input array is empty. The logging is done via BaseLogger, ensuring that any issues or results are recorded appropriately.

Since:
1.0.0
  • Method Details

    • calculateMean

      public static double calculateMean(double[] pValues)
      A Double that calculates the mean (average) of an array of values.

      Logs a warning if the array is empty and a success message with the calculated mean.

      Parameters:
      pValues - Double - The array of values to calculate the mean for.
      Returns:
      The mean of the values.
      Since:
      1.0.0
    • calculateMedian

      public static double calculateMedian(double[] pValues)
      A Double[] that calculates the median of an array of values.

      Logs a warning if the array is empty and a success message with the calculated median.

      Parameters:
      pValues - Double[] - The array of values to calculate the median for.
      Returns:
      The median of the values.
      Since:
      1.0.0
    • calculateMode

      public static double calculateMode(double[] pValues)
      A Double[] that calculates the mode (the most frequent value) of an array of values.

      Logs a warning if the array is empty and a success message with the calculated mode.

      Parameters:
      pValues - Double[] - The array of values to calculate the mode for.
      Returns:
      The mode of the values.
      Since:
      1.0.0
    • calculateStandardDeviation

      public static double calculateStandardDeviation(double[] pValues)
      A Double[] that calculates the standard deviation of an array of values.

      Logs a warning if the array is empty and a success message with the calculated standard deviation.

      Parameters:
      pValues - Double[] - The array of values to calculate the standard deviation for.
      Returns:
      The standard deviation of the values.
      Since:
      1.0.0
    • calculateVariance

      public static double calculateVariance(double[] pValues)
      A Double[] that calculates the variance of an array of values.

      Logs a warning if the array is empty and a success message with the calculated variance.

      Parameters:
      pValues - Double[] - The array of values to calculate the variance for.
      Returns:
      The variance of the values.
      Since:
      1.0.0
    • calculateRange

      public static double calculateRange(double[] pValues)
      A Double[] that calculates the range (difference between maximum and minimum) of an array of values.

      Logs a warning if the array is empty and a success message with the calculated range.

      Parameters:
      pValues - Double[] - The array of values to calculate the range for.
      Returns:
      The range of the values.
      Since:
      1.0.0
    • calculateCoefficientOfVariation

      public static double calculateCoefficientOfVariation(double[] pValues)
      A Double[] that calculates the coefficient of variation of an array of values.

      Logs a warning if the array is empty and a success message with the calculated coefficient of variation.

      Parameters:
      pValues - Double[] - The array of values to calculate the coefficient of variation for.
      Returns:
      The coefficient of variation of the values.
      Since:
      1.0.0