commons-statistics-regression/src/main/java/org/apache/commons/statistics/regression/util/matrix/StatisticsMatrix.java
/**
     * Computes the unbiased standard deviation of all the elements.
     *
     * @return standard deviation
     * @throws IllegalArgumentException if there is less than 2 elements.
     */
Computes the unbiased standard deviation of all the elements.
@return standard deviation
@throws IllegalArgumentException if there is less than 2 elements.
Computes the unbiased standard deviation of all the elements . @return standard deviation @throws IllegalArgumentException if there is less than 2 elements .
public double stdev() {
        double m = mean();
        double total = 0;
        final int n = getNumElements();
        if (n <= 1) {
            throw new IllegalArgumentException("There must be more than one element to compute stdev");
        }
        for (int i = 0; i < n; i++) {
            double x = get(i);
            total += (x - m) * (x - m);
        }
        total /= n - 1;
        return Math.sqrt(total);
    }
public double stdev ( ) { double m = mean ( ) ; double total = 0 ; final int n = getNumElements ( ) ; if ( n <= 1 ) { throw new IllegalArgumentException ( "There must be more than one element to compute stdev" ) ; } for ( int i = 0 ; i < n ; i ++ ) { double x = get ( i ) ; total += ( x - m ) * ( x - m ) ; } total /= n - 1 ; return Math . sqrt ( total ) ; }
Computes the unbiased standard deviation of all the elements.
Computes the unbiased standard deviation of all the elements .