Returns standard variation (rozptyl) DV = sqrt( 1/N * SUM ( Xi - mu )^2 ) - Java java.lang

Java examples for java.lang:Math Trigonometric Function

Description

Returns standard variation (rozptyl) DV = sqrt( 1/N * SUM ( Xi - mu )^2 )

Demo Code


//package com.java2s;

public class Main {
    /**//from  w w w . jav a2  s .  c  o m
     * Returns standard variation (rozptyl)
     *
     * DV = sqrt( 1/N * SUM ( Xi - mu )^2 )
     * 
     * @param EV
     * @param data
     * @return Standard variation
     */
    public static double getStandVar(double EV, double[] data) {
        double DV = 0;
        for (int i = 0; i < data.length; i++) {
            DV += Math.pow(data[i] - EV, 2);
        }
        DV = DV / (data.length);
        return DV;
    }
}

Related Tutorials