Gephi Toolkit Javadoc

org.gephi.utils
Class StatisticsUtils

java.lang.Object
  extended by org.gephi.utils.StatisticsUtils

public class StatisticsUtils
extends java.lang.Object

Class with some statistics methods for calculating values such as the average, median, sum, max and min of a list of numbers.

Author:
Eduardo Ramos

Constructor Summary
StatisticsUtils()
           
 
Method Summary
static java.math.BigDecimal average(java.util.Collection<java.lang.Number> numbers)
          Get average calculation of various numbers as a BigDecimal
static java.math.BigDecimal average(java.lang.Number[] numbers)
          Get average calculation of various numbers as a BigDecimal
static java.math.BigDecimal[] getAllStatistics(java.util.Collection<java.lang.Number> numbers)
          Calculates all statistics and returns them in a BigDecimal numbers array.
static java.math.BigDecimal[] getAllStatistics(java.lang.Number[] numbers)
          Calculates all statistics and returns them in a BigDecimal numbers array.
static java.math.BigDecimal maxValue(java.util.Collection<java.lang.Number> numbers)
          Get the maximum value of a collection of Number elements as a BigDecimal.
static java.math.BigDecimal maxValue(java.lang.Number[] numbers)
          Get the maximum value of an array of Number elements as a BigDecimal.
static java.math.BigDecimal median(java.util.Collection<java.lang.Number> numbers)
          Calculate median of various numbers as a BigDecimal.
static java.math.BigDecimal median(java.lang.Number[] numbers)
          Calculate median of various numbers as a BigDecimal.
static java.math.BigDecimal minValue(java.util.Collection<java.lang.Number> numbers)
          Get the minimum value of a collection of Number elements as a BigDecimal.
static java.math.BigDecimal minValue(java.lang.Number[] numbers)
          Get the minimum value of an array of Number elements as a BigDecimal.
static java.math.BigDecimal[] numbersArrayToSortedBigDecimalArray(java.lang.Number[] numbers)
          Takes an array of numbers of any type combination and returns an array with their BigDecimal equivalent numbers.
static java.math.BigDecimal quartile1(java.util.Collection<java.lang.Number> numbers)
          Calculate first quartile (Q1) of various numbers as a BigDecimal.
static java.math.BigDecimal quartile1(java.lang.Number[] numbers)
          Calculate first quartile (Q1) of various numbers as a BigDecimal.
static java.math.BigDecimal quartile3(java.util.Collection<java.lang.Number> numbers)
          Calculate third quartile (Q3) of various numbers as a BigDecimal.
static java.math.BigDecimal quartile3(java.lang.Number[] numbers)
          Calculate third quartile (Q3) of various numbers as a BigDecimal.
static java.math.BigDecimal sum(java.util.Collection<java.lang.Number> numbers)
          Get sum of various numbers as a BigDecimal
static java.math.BigDecimal sum(java.lang.Number[] numbers)
          Get sum of various numbers as a BigDecimal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatisticsUtils

public StatisticsUtils()
Method Detail

average

public static java.math.BigDecimal average(java.lang.Number[] numbers)

Get average calculation of various numbers as a BigDecimal

Null values will not be counted.

Parameters:
numbers - Numbers to calculate average
Returns:
Average as a BigDecimal

average

public static java.math.BigDecimal average(java.util.Collection<java.lang.Number> numbers)

Get average calculation of various numbers as a BigDecimal

Null values will not be counted.

Parameters:
numbers - Numbers to calculate average
Returns:
Average as a BigDecimal

median

public static java.math.BigDecimal median(java.lang.Number[] numbers)

Calculate median of various numbers as a BigDecimal.

The elements can't be null.

The elements don't need to be sorted.

Parameters:
numbers - Not null numbers to calculate median
Returns:
Median as a BigDecimal

median

public static java.math.BigDecimal median(java.util.Collection<java.lang.Number> numbers)

Calculate median of various numbers as a BigDecimal.

The elements can't be null.

The elements don't need to be sorted.

Parameters:
numbers - Not null numbers to calculate median
Returns:
Median as a BigDecimal

quartile1

public static java.math.BigDecimal quartile1(java.lang.Number[] numbers)

Calculate first quartile (Q1) of various numbers as a BigDecimal.

The elements can't be null.

The elements don't need to be sorted.

Parameters:
numbers - Not null numbers to calculate Q1
Returns:
Q1 as a BigDecimal

quartile1

public static java.math.BigDecimal quartile1(java.util.Collection<java.lang.Number> numbers)

Calculate first quartile (Q1) of various numbers as a BigDecimal.

The elements can't be null.

The elements don't need to be sorted.

Parameters:
numbers - Not null numbers to calculate Q1
Returns:
Q1 as a BigDecimal

quartile3

public static java.math.BigDecimal quartile3(java.lang.Number[] numbers)

Calculate third quartile (Q3) of various numbers as a BigDecimal.

The elements can't be null.

The elements don't need to be sorted.

Parameters:
numbers - Not null numbers to calculate Q3
Returns:
Q3 as a BigDecimal

quartile3

public static java.math.BigDecimal quartile3(java.util.Collection<java.lang.Number> numbers)

Calculate third quartile (Q3) of various numbers as a BigDecimal.

The elements can't be null.

The elements don't need to be sorted.

Parameters:
numbers - Not null numbers to calculate Q3
Returns:
Q3 as a BigDecimal

sum

public static java.math.BigDecimal sum(java.lang.Number[] numbers)

Get sum of various numbers as a BigDecimal

Null values will not be counted.

Parameters:
numbers - Numbers to calculate sum
Returns:
Sum as a BigDecimal

sum

public static java.math.BigDecimal sum(java.util.Collection<java.lang.Number> numbers)

Get sum of various numbers as a BigDecimal

Null values will not be counted.

Parameters:
numbers - Numbers to calculate sum
Returns:
Sum as a BigDecimal

minValue

public static java.math.BigDecimal minValue(java.lang.Number[] numbers)

Get the minimum value of an array of Number elements as a BigDecimal.

The elements can't be null.

The elements don't need to be sorted.

Parameters:
numbers - Numbers to get min
Returns:
Minimum value as a BigDecimal

minValue

public static java.math.BigDecimal minValue(java.util.Collection<java.lang.Number> numbers)

Get the minimum value of a collection of Number elements as a BigDecimal.

The elements can't be null.

The elements don't need to be sorted.

Parameters:
numbers - Numbers to get min
Returns:
Minimum value as a BigDecimal

maxValue

public static java.math.BigDecimal maxValue(java.lang.Number[] numbers)

Get the maximum value of an array of Number elements as a BigDecimal.

The elements can't be null.

The elements don't need to be sorted.

Parameters:
numbers - Numbers to get max
Returns:
Maximum value as a BigDecimal

maxValue

public static java.math.BigDecimal maxValue(java.util.Collection<java.lang.Number> numbers)

Get the maximum value of a collection of Number elements as a BigDecimal.

The elements can't be null.

The elements don't need to be sorted.

Parameters:
numbers - Numbers to get max
Returns:
Maximum value as a BigDecimal

getAllStatistics

public static java.math.BigDecimal[] getAllStatistics(java.lang.Number[] numbers)

Calculates all statistics and returns them in a BigDecimal numbers array.

Using this will be faster than calling all statistics separately.

Returns an array of length=8 of BigDecimal numbers with the results in the following order:

  1. average
  2. first quartile (Q1)
  3. median
  4. third quartile (Q3)
  5. interquartile range (IQR)
  6. sum
  7. minimumValue
  8. maximumValue

The elements can't be null.

The elements don't need to be sorted.

Parameters:
numbers - Numbers to get all statistics
Returns:
Array with all statisctis

getAllStatistics

public static java.math.BigDecimal[] getAllStatistics(java.util.Collection<java.lang.Number> numbers)

Calculates all statistics and returns them in a BigDecimal numbers array.

Using this will be faster than calling all statistics separately.

Returns an array of length=8 of BigDecimal numbers with the results in the following order:

  1. average
  2. first quartile (Q1)
  3. median
  4. third quartile (Q3)
  5. interquartile range (IQR)
  6. sum
  7. minimumValue
  8. maximumValue

The elements can't be null.

The elements don't need to be sorted.

Parameters:
numbers - Numbers to get all statistics
Returns:
Array with all statisctis

numbersArrayToSortedBigDecimalArray

public static java.math.BigDecimal[] numbersArrayToSortedBigDecimalArray(java.lang.Number[] numbers)

Takes an array of numbers of any type combination and returns an array with their BigDecimal equivalent numbers.

Returns:
BigDecimal array

Gephi Toolkit Javadoc