Java stddev getStandardDeviation(double meanValue, ArrayList values)

Here you can find the source of getStandardDeviation(double meanValue, ArrayList values)

Description

get Standard Deviation

License

Open Source License

Declaration

public static double getStandardDeviation(double meanValue, ArrayList<Double> values) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

public class Main {
    public static double getStandardDeviation(double meanValue, ArrayList<Double> values) {
        if (values.isEmpty()) {
            return -1.0;
        }/* www .j  av a  2s  . c o  m*/

        double sum = 0.0;
        for (Double value : values) {
            sum += Math.pow(meanValue - value, 2.0);
        }

        return Math.sqrt(sum / values.size());
    }
}

Related

  1. standardDeviation(double[] data)
  2. standardDeviation(double[] data, int opt)
  3. std(Collection dist, boolean populationStd)
  4. std(double a[])