Example usage for org.apache.commons.math.distribution NormalDistribution setMean

List of usage examples for org.apache.commons.math.distribution NormalDistribution setMean

Introduction

In this page you can find the example usage for org.apache.commons.math.distribution NormalDistribution setMean.

Prototype

@Deprecated
void setMean(double mean);

Source Link

Document

Modify the mean.

Usage

From source file:org.bdval.MaqciiHelper.java

private double stouffer(final double[] pval) {
    double rval = 1.0;
    final NormalDistribution normd = new NormalDistributionImpl();
    normd.setMean(0);
    normd.setStandardDeviation(1);// w w  w.j av a 2s.  co  m
    final int size = pval.length;
    final double[] z = new double[size];
    double zCombine = 0;

    for (int i = 0; i < size; i++) {
        try {
            z[i] = normd.inverseCumulativeProbability(pval[i]);
        } catch (MathException e) {
            LOG.warn("Error calculating probability", e);
        }
        zCombine += z[i];
    }
    zCombine /= Math.sqrt(size);

    try {
        rval = normd.cumulativeProbability(zCombine);
    } catch (MathException e) {
    }

    return rval;
}