Class StatisticalUtils
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:
calculateMean(double[])- Calculates the mean (average) of an array of values.calculateMedian(double[])- Calculates the median value of an array of values.calculateMode(double[])- Determines the mode (most frequent value) of an array of values.calculateStandardDeviation(double[])- Computes the standard deviation of an array of values.calculateVariance(double[])- Computes the variance of an array of values.calculateRange(double[])- Determines the range (difference between maximum and minimum) of an array of values.calculateCoefficientOfVariation(double[])- Calculates the coefficient of variation (CV) of an array of values.
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 Summary
Modifier and TypeMethodDescriptionstatic doublecalculateCoefficientOfVariation(double[] pValues) ADouble[]that calculates the coefficient of variation of an array of values.static doublecalculateMean(double[] pValues) ADoublethat calculates the mean (average) of an array of values.static doublecalculateMedian(double[] pValues) ADouble[]that calculates the median of an array of values.static doublecalculateMode(double[] pValues) ADouble[]that calculates the mode (the most frequent value) of an array of values.static doublecalculateRange(double[] pValues) ADouble[]that calculates the range (difference between maximum and minimum) of an array of values.static doublecalculateStandardDeviation(double[] pValues) ADouble[]that calculates the standard deviation of an array of values.static doublecalculateVariance(double[] pValues) ADouble[]that calculates the variance of an array of values.
-
Method Details
-
calculateMean
public static double calculateMean(double[] pValues) ADoublethat 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) ADouble[]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) ADouble[]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) ADouble[]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) ADouble[]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) ADouble[]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) ADouble[]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
-