public class Stats
extends java.lang.Object
Constructor and Description |
---|
Stats() |
Modifier and Type | Method and Description |
---|---|
static double |
average(java.util.List<java.lang.Double> data,
java.util.List<java.lang.Double> weights)
Return weighted average value of
data and weights . |
static double |
hMean(double a,
double b)
Return harmonic mean.
|
static double[] |
max(double[] data)
Find out the maximum element and its index of an array
|
static int[] |
max(int[] data)
Find out the maximum element and its index of an array.
|
static double |
mean(java.util.Collection<? extends java.lang.Number> data)
Return mean value of a sample.
|
static double |
mean(double[] data)
reference:
http://www.weibull.com/DOEWeb/unbiased_and_biased_estimators.htm
|
static double |
median(java.util.Collection<? extends java.lang.Number> data)
Calculate the median value of a data collection,
Note that the values of doulbe.NaN will be ignored silently
|
static double |
median(double[] data)
Calculate the median value of an array,
Note that the values of doulbe.NaN will be ignored silently.
|
static double[] |
min(double[] data)
Find out the minimum element and its index of an array.
|
static int[] |
min(int[] data)
Find out the minimum element and its index of an array.
|
static double |
mode(double[] data) |
static double |
sd(java.util.Collection<? extends java.lang.Number> data)
Calculate the standard deviation.
|
static double |
sd(java.util.Collection<? extends java.lang.Number> data,
double mean)
Calculate the standard deviation.
|
static double |
sd(double[] data)
Calculate a sample's standard deviation.
|
static double |
sd(double[] data,
double mean)
Calculate a sample's standard deviation.
|
static double |
sum(java.util.Collection<? extends java.lang.Number> data) |
static double |
sum(double[] data) |
static int |
sum(int n)
The sum from 1 to n.
|
static int |
sum(int[] data) |
static double |
sumSquare(int n)
The sum from 1^2 to n^2, with the largest value to n^3/3
|
static double |
var(double[] data)
Calculate a sample's variance.
|
static double |
var(double[] data,
double mean)
Calculate a sample's variance
|
static double |
weightedcMean(double[] a,
double[] w) |
public static double mean(java.util.Collection<? extends java.lang.Number> data)
data
- the set to sample frompublic static double hMean(double a, double b)
a
- parameter of the functionb
- parameter of the functionpublic static double mean(double[] data)
Notes: the sample mean and population mean is estimated in the same way.
data
- the set to sample frompublic static double mode(double[] data)
public static double weightedcMean(double[] a, double[] w)
public static double average(java.util.List<java.lang.Double> data, java.util.List<java.lang.Double> weights)
data
and weights
.data
- data setweights
- weight for the datadata
and weights
public static double median(double[] data)
data
- an arraypublic static double median(java.util.Collection<? extends java.lang.Number> data)
data
- a data collectionpublic static double var(double[] data)
data
- a data arraypublic static double var(double[] data, double mean)
refers to: http://www.weibull.com/DOEWeb/unbiased_and_biased_estimators.htm, for an explanation why the denominator is (n-1) rather than n.
data
- a data arraymean
- mean of the data arraypublic static double sd(java.util.Collection<? extends java.lang.Number> data)
data
- a data collectionpublic static double sd(java.util.Collection<? extends java.lang.Number> data, double mean)
data
- a data collectionmean
- mean of the collectionpublic static double sd(double[] data)
data
- a data arraypublic static double sd(double[] data, double mean)
data
- a data arraymean
- mean of the datapublic static double sum(double[] data)
public static double sum(java.util.Collection<? extends java.lang.Number> data)
public static int sum(int[] data)
public static int sum(int n)
n
- max of the sum sequencepublic static double sumSquare(int n)
n
- parameter n of the functionpublic static double[] max(double[] data)
data
- a data arraypublic static int[] max(int[] data)
data
- a data arraypublic static int[] min(int[] data)
data
- a data arraypublic static double[] min(double[] data)
data
- a data arrayCopyright © 2017. All Rights Reserved.