Class StatisticsUtils
- java.lang.Object
-
- fr.ens.biologie.genomique.aozan.util.StatisticsUtils
-
public class StatisticsUtils extends Object
This class contains statistics methods, using the class DescriptiveStatistics from commons.apache.math.- Since:
- 1.1
- Author:
- Sandrine Perrin
-
-
Constructor Summary
Constructors Constructor Description StatisticsUtils()
Public constructor with a empty dataset.StatisticsUtils(Collection<? extends Number> list)
Public constructor, build a list of values used for compute statistics.StatisticsUtils(List<? extends Number> list)
Public constructor, build a list of values used for compute statistics.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addValues(Number number)
Add values in dataset.org.apache.commons.math3.stat.descriptive.DescriptiveStatistics
getDescriptiveStatistics()
Returns the instance of DescriptiveStatistics.org.apache.commons.math3.stat.descriptive.DescriptiveStatistics
getDescriptiveStatisticsWithZero()
Returns the instance of DescriptiveStatistics which doesn't contain the value zero.Double
getMax()
Double
getMean()
Compute the mean for values.int
getMeanToInteger()
Compute the mean for values.Double
getMeanWithoutZero()
Compute the mean for values which are different of 0.int
getMeanWithoutZeroToInteger()
Compute the mean for values which are different of 0Double
getMediane()
Compute the median for values.int
getMedianeToInteger()
Compute the median for values.Double
getMedianWithoutZero()
Compute the median for values which are different of 0.int
getMedianWithoutZeroToInteger()
Compute the median for values which are different of 0.Double
getMin()
Double
getStandardDeviation()
Compute the standard deviation for values.Double
getStandardDeviation(boolean isBiasCorrected)
Compute the standard deviation for values.int
getStandardDeviationToInteger()
Compute the standard deviation for values.Double
getSum()
Compute the sum of values.int
getSumToInteger()
Compute the sum of values.String
printValues()
Print dataset.String
printValuesWithoutZero()
Print dataset.
-
-
-
Constructor Detail
-
StatisticsUtils
public StatisticsUtils(List<? extends Number> list)
Public constructor, build a list of values used for compute statistics. Infinity values are ignored.- Parameters:
list
- values
-
StatisticsUtils
public StatisticsUtils(Collection<? extends Number> list)
Public constructor, build a list of values used for compute statistics. Infinity values are ignored.- Parameters:
list
- values
-
StatisticsUtils
public StatisticsUtils()
Public constructor with a empty dataset.
-
-
Method Detail
-
getMean
public Double getMean()
Compute the mean for values.- Returns:
- mean or NaN if no values have been added, or 0.0 for a single value set.
-
getMeanWithoutZero
public Double getMeanWithoutZero()
Compute the mean for values which are different of 0.- Returns:
- mean or NaN if no values have been added, or 0.0 for a single value set.
-
getMedianWithoutZero
public Double getMedianWithoutZero()
Compute the median for values which are different of 0.- Returns:
- median or NaN if no values have been added, or 0.0 for a single value set.
-
getMediane
public Double getMediane()
Compute the median for values.- Returns:
- median or NaN if no values have been added, or 0.0 for a single value set.
-
getSum
public Double getSum()
Compute the sum of values.- Returns:
- sum of values.
-
getStandardDeviation
public Double getStandardDeviation()
Compute the standard deviation for values.- Returns:
- standard deviation or NaN if no values have been added, or 0.0 for a single value set.
-
getMeanToInteger
public int getMeanToInteger()
Compute the mean for values.- Returns:
- mean or NaN if no values have been added, or 0.0 for a single value set.
-
getMeanWithoutZeroToInteger
public int getMeanWithoutZeroToInteger()
Compute the mean for values which are different of 0- Returns:
- mean or NaN if no values have been added, or 0.0 for a single value set.
-
getMedianWithoutZeroToInteger
public int getMedianWithoutZeroToInteger()
Compute the median for values which are different of 0.- Returns:
- median or NaN if no values have been added, or 0.0 for a single value set.
-
getMedianeToInteger
public int getMedianeToInteger()
Compute the median for values.- Returns:
- median or NaN if no values have been added, or 0.0 for a single value set.
-
getSumToInteger
public int getSumToInteger()
Compute the sum of values.- Returns:
- sum of values.
-
getStandardDeviationToInteger
public int getStandardDeviationToInteger()
Compute the standard deviation for values.- Returns:
- standard deviation or NaN if no values have been added, or 0.0 for a single value set.
-
getMin
public Double getMin()
-
getMax
public Double getMax()
-
getDescriptiveStatistics
public org.apache.commons.math3.stat.descriptive.DescriptiveStatistics getDescriptiveStatistics()
Returns the instance of DescriptiveStatistics.- Returns:
- instance of DescriptiveStatistics
-
getDescriptiveStatisticsWithZero
public org.apache.commons.math3.stat.descriptive.DescriptiveStatistics getDescriptiveStatisticsWithZero()
Returns the instance of DescriptiveStatistics which doesn't contain the value zero.- Returns:
- instance of DescriptiveStatistics
-
printValuesWithoutZero
public String printValuesWithoutZero()
Print dataset.- Returns:
- string of dataset
-
printValues
public String printValues()
Print dataset.- Returns:
- string of dataset
-
getStandardDeviation
public Double getStandardDeviation(boolean isBiasCorrected)
Compute the standard deviation for values.- Parameters:
isBiasCorrected
- false per default- Returns:
- standard deviation NaN if no values have been added, or 0.0 for a single value set.
-
addValues
public void addValues(Number number)
Add values in dataset.- Parameters:
number
- new values to put in dataset
-
-