Example usage for org.apache.commons.math3.stat.descriptive StatisticalSummary getN

List of usage examples for org.apache.commons.math3.stat.descriptive StatisticalSummary getN

Introduction

In this page you can find the example usage for org.apache.commons.math3.stat.descriptive StatisticalSummary getN.

Prototype

long getN();

Source Link

Document

Returns the number of available values

Usage

From source file:ijfx.core.stats.DefaultImageStatisticsService.java

@Override
public Map<String, Double> summaryStatisticsToMap(StatisticalSummary summaryStats) {

    Map<String, Double> statistics = new HashMap<>();
    statistics.put(LBL_MEAN, summaryStats.getMean());
    statistics.put(LBL_MIN, summaryStats.getMin());
    statistics.put(LBL_MAX, summaryStats.getMax());
    statistics.put(LBL_SD, summaryStats.getStandardDeviation());
    statistics.put(LBL_VARIANCE, summaryStats.getVariance());
    statistics.put(LBL_PIXEL_COUNT, (double) summaryStats.getN());
    return statistics;
}

From source file:gdsc.smlm.ij.plugins.PSFEstimator.java

private void getP(StatisticalSummary sample1, StatisticalSummary sample2, int i, double[] p,
        boolean[] identical) {
    if (sample1.getN() < 2)
        return;//  ww w .ja v a2s.co m

    // The number returned is the smallest significance level at which one can reject the null 
    // hypothesis that the mean of the paired differences is 0 in favor of the two-sided alternative 
    // that the mean paired difference is not equal to 0. For a one-sided test, divide the returned value by 2
    p[i] = TestUtils.tTest(sample1, sample2);
    identical[i] = (p[i] > settings.pValue);
}

From source file:org.briljantframework.data.dataframe.transform.ZNormalizer.java

@Override
public Transformer fit(DataFrame df) {
    Vector.Builder meanBuilder = Vector.Builder.of(Double.class);
    Vector.Builder stdBuilder = Vector.Builder.of(Double.class);
    for (Object columnKey : df) {
        StatisticalSummary stats = Vectors.statisticalSummary(df.get(columnKey));
        if (stats.getN() <= 0 || Is.NA(stats.getMean()) || Is.NA(stats.getStandardDeviation())) {
            throw new IllegalArgumentException("Illegal value for column " + columnKey);
        }//from   ww  w  . jav a  2s  .  c o m
        meanBuilder.set(columnKey, stats.getMean());
        stdBuilder.set(columnKey, stats.getStandardDeviation());
    }
    Vector mean = meanBuilder.build();
    Vector sigma = stdBuilder.build();

    return new ZNormalizerTransformer(mean, sigma);
}

From source file:org.italiangrid.voms.aa.x509.stats.ExecutionTimeStats.java

public static ExecutionTimeStats fromSummaryStats(StatisticalSummary stats) {

    ExecutionTimeStats v = new ExecutionTimeStats();

    v.setMax(stats.getMax());/* w  w  w . jav a 2  s  . c  om*/
    v.setMin(stats.getMin());
    v.setMean(stats.getMean());
    v.setCount(stats.getN());
    return v;
}

From source file:prm4jeval.dataanalysis.ConfidenceInterval.java

public static double getConfidenceIntervalWidth(StatisticalSummary summaryStatistics, double significance) {
    RealDistribution tDist = new TDistribution(summaryStatistics.getN() - 1);
    double t = tDist.inverseCumulativeProbability(1.0 - significance / 2);
    return 2 * t * summaryStatistics.getStandardDeviation() / Math.sqrt(summaryStatistics.getN());
}