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

floatstd(float[][] arr)
Calculate the standard deviation of a 2D array.
return (float) Math.sqrt(var(arr));
doublestd(long[] 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 (long value : array) {
    double tmpM = M;
    M += (value - tmpM) / k;
...
doublestdarr(int[] a, double avg)
stdarr
double res = 0.0;
for (int i = 0; i < a.length; i++)
    res += (a[i] - avg) * (a[i] - avg);
return (Math.sqrt(res / (a.length - 1)));
doublestddev(Collection a)
Compute the sample standard deviation for a Collection of numeric types
return Math.sqrt(variance(a));
doublestdDev(Collection coll)
std Dev
if (coll == null || coll.size() < 2)
    throw new IllegalArgumentException();
double mean = mean(coll);
double res = 0;
for (Number n : coll) {
    double d = n.doubleValue() - mean;
    res += d * d;
return res / (coll.size() - 1);
doublestddev(double sum, double sqSum, int numberValues)
stddev
double variance = (sqSum - (sum * sum) / numberValues) / (numberValues - 1);
return Math.sqrt(variance);
doublestddev(double[] a)
Computes the standard deviation of an array
double std = 0;
double ave = mean(a);
for (double d : a)
    std += (d - ave) * (d - ave);
return Math.sqrt(std / (double) a.length);
doublestddev(double[] arr)
stddev
double mean = mean(arr);
double sum = 0;
for (double d : arr) {
    sum += Math.pow(d - mean, 2);
return Math.sqrt(sum / (arr.length - 1));
doublestdDev(double[] array)
std Dev
double mean = 0.0;
double total = 0.0;
for (int m = 0; m < array.length; m++) {
    total += array[m];
mean = total / array.length;
return stdDev(array, mean);
doublestdDev(double[] data)
Compute the standard deviation of the given data
double mean = 0;
double S = 0;
for (int i = 0; i < data.length; i++) {
    double delta = data[i] - mean;
    mean += delta / (i + 1);
    S += delta * (data[i] - mean);
return Math.sqrt(S / data.length);
...