Java Utililty Methods stddev

List of utility methods to do stddev

Description

The list of methods to do stddev are organized into topic(s).

Method

doublegetStandardDeviation(double meanValue, ArrayList values)
get Standard Deviation
if (values.isEmpty()) {
    return -1.0;
double sum = 0.0;
for (Double value : values) {
    sum += Math.pow(meanValue - value, 2.0);
return Math.sqrt(sum / values.size());
...
doublestandardDeviation(double[] data)
standard Deviation
return standardDeviation(data, mean(data));
doublestandardDeviation(double[] data, int opt)
Compute the standard deviation of the given data, this function can deal with NaNs
if (opt == 0)
    return Math.sqrt(variance(data, opt));
else
    return Math.sqrt(variance(data, opt));
Doublestd(Collection dist, boolean populationStd)
std
return std(mean(dist), dist, populationStd);
doublestd(double a[])
std
double V = var(a);
return Math.sqrt(V);
doublestd(double[] a)
Returns the standard variance.
return std(a, a.length);
doublestd(double[] arr)
std
double m = mean(arr);
double sum = 0.0;
for (int i = 0; i < arr.length; ++i) {
    sum += Math.pow(arr[i] - m, 2);
return Math.sqrt(sum / arr.length);
doublestd(double[] array)
Returns the standard deviation of an array using the Welford's method.
if (array.length == 0)
    return 0;
double M = 0.0;
double S = 0.0;
int k = 1;
for (double value : array) {
    double tmpM = M;
    M += (value - tmpM) / k;
...
doublestd(final double[] vec)
Computes the standard deviation of the given values, that is the square root of the sample variance.
assert vec != null;
return Math.sqrt(var(vec));
doublestd(final double[] x, final int begin, final int end)
std
int N = 0;
double mean = 0d;
for (int i = Math.max(0, begin); i < Math.min(x.length - 1, end); i++) {
    mean += x[i];
    N++;
mean /= N;
double std = 0d;
...