Java examples for java.lang:Math Function
Returns Least absolute deviation DV = sqrt ( 1/N * SUM | Xi - mu | )
//package com.java2s; public class Main { /**/*ww w. j a v a 2s . c om*/ * Returns Least absolute deviation (absolutn? chyba) * * DV = sqrt ( 1/N * SUM | Xi - mu | ) * * @param EV * @param data * @return Standard deviation */ public static double getLAD(double EV, double[] data) { double DV = 0; for (int i = 0; i < data.length; i++) { DV += Math.abs(data[i] - EV); } DV = DV / (data.length); return DV; } }