Example usage for org.apache.commons.math3.stat.descriptive.moment Skewness evaluate

List of usage examples for org.apache.commons.math3.stat.descriptive.moment Skewness evaluate

Introduction

In this page you can find the example usage for org.apache.commons.math3.stat.descriptive.moment Skewness evaluate.

Prototype

@Override
public double evaluate(final double[] values) throws MathIllegalArgumentException 

Source Link

Document

This default implementation calls #clear , then invokes #increment in a loop over the the input array, and then uses #getResult to compute the return value.

Usage

From source file:com.facebook.presto.operator.aggregation.TestDoubleSkewnessAggregation.java

@Override
public Number getExpectedValue(int start, int length) {
    if (length < 3) {
        return null;
    }//ww  w  .  j a va2s .c om

    double[] values = new double[length];
    for (int i = 0; i < length; i++) {
        values[i] = start + i;
    }

    Skewness skewness = new Skewness();
    return skewness.evaluate(values);
}

From source file:msi.gaml.operators.Stats.java

@operator(value = "skewness", can_be_const = false,
        // type = IType.LIST,
        category = { IOperatorCategory.STATISTICAL }, concept = { IConcept.STATISTIC, IConcept.CLUSTERING })
@doc(value = "returns skewness value computed from the operand list of values", special_cases = "if the length of the list is lower than 3, returns NaN", examples = {
        @example(value = "skewness ([1,2,3,4,5])", equals = "0.0") })
public static Double skewness(final IScope scope, final GamaList data) throws GamaRuntimeException {
    final Skewness sk = new Skewness();
    final double[] values = new double[data.length(scope)];
    for (int i = 0; i < values.length; i++) {
        values[i] = Cast.asFloat(scope, data.get(i));
    }//from w w w  .  ja  va  2s  . co  m
    return sk.evaluate(values);
}