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

doublestddev(double[] observations)
stddev
return Math.sqrt(variance(observations));
doublestddev(final double[] in, final int start, final int length)
Calculate the (population) standard deviation of an array of doubles.
return stddev(in, start, length, mean(in, start, length));
floatstddev(final int[] scores)
stddev
if (scores.length == 0) {
    return 0f;
final float v = variance(scores);
return (float) Math.sqrt(v);
doublestddev(float[] data)
stddev
double d = 0;
float mn = (float) mean(data);
for (int i = 0; i < data.length; i++)
    d += (data[i] - mn) * (data[i] - mn);
d /= data.length;
return Math.sqrt(d);
float[]stddev(int[] values, int start, int length)
Computes the standard deviation of the supplied values.
float mean = 0f;
for (int ii = start, end = start + length; ii < end; ii++) {
    mean += values[ii];
mean /= length;
float variance = 0f;
for (int ii = start, end = start + length; ii < end; ii++) {
    float value = values[ii] - mean;
...
DoublestdDev(Integer[] values)
std Dev
Double variance = variance(values);
if (variance == null) {
    return null;
return Math.sqrt(variance.doubleValue());
doublestddev(long[] samples)
stddev
double avg = average(samples);
double result = 0;
for (long sample : samples) {
    result += (sample - avg) * (sample - avg);
result /= samples.length;
return Math.sqrt(result);
doublestddev(Number[] array, boolean isSample)
Returns the std deviation of the given array.
double result;
double mean;
int i;
if (array.length == 0)
    return Double.NaN;
result = 0;
mean = mean(array);
for (i = 0; i < array.length; i++)
...
doublestdDev(T[] array)
Returns the population standard deviation of the given values.
double[] temp = new double[array.length];
for (int i = 0; i < array.length; i++) {
    temp[i] = array[i].doubleValue();
return stdDev(temp);
doublestdDeviation(int[] data)
Returns standard deviation of array of ints
double mean = mean(data);
double sum = 0;
for (int i = 0; i < data.length; i++) {
    sum += Math.pow(data[i] - mean, 2);
return Math.sqrt((sum) / (data.length - 1));