Java List Mean getStandardDeviation(double meanValue, List values)

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

Description

get Standard Deviation

License

Open Source License

Declaration

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

Method Source Code

//package com.java2s;
/*/*from w ww. java2s.c om*/
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    Copyright (C) 2015 George Antony Papadakis (gpapadis@yahoo.gr)
 */

import java.util.List;

public class Main {
    public static double getStandardDeviation(double meanValue,
            List<Double> values) {
        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() - 1));
    }
}

Related

  1. computeMean(List fs)
  2. geometricMean(List vals, double replacement)
  3. getHMean(List harray)
  4. getMean(List data)
  5. getMean(List list)
  6. getStandardDeviation(List doubles, Double mean)
  7. getStandardDeviationOfMean(List doubles)
  8. mean(double[] list)
  9. mean(final List list)