public Date getMean() { final double meanTimestamp = _statistics.getMean(); if (Double.isNaN(meanTimestamp)) { return null; } return new Date(Double.valueOf(meanTimestamp).longValue()); }
public Date getMean() { double meanTimestamp = _statistics.getMean(); if (Double.isNaN(meanTimestamp)) { return null; } return new Date(Double.valueOf(meanTimestamp).longValue()); }
@Override protected Serializable reduceValues(final List<Object> slaveValues, final String column, final String measure, final Collection<? extends NumberAnalyzerResult> results, final Class<?> valueClass) { if (SUM_MEASURES.contains(measure)) { return sum(slaveValues); } else if (NumberAnalyzer.MEASURE_HIGHEST_VALUE.equals(measure)) { return maximum(slaveValues); } else if (NumberAnalyzer.MEASURE_LOWEST_VALUE.equals(measure)) { return minimum(slaveValues); } else if (NumberAnalyzer.MEASURE_MEAN.equals(measure)) { final StatisticalSummary summary = getSummary(column, results); return summary.getMean(); } else if (NumberAnalyzer.MEASURE_STANDARD_DEVIATION.equals(measure)) { final StatisticalSummary summary = getSummary(column, results); return summary.getStandardDeviation(); } else if (NumberAnalyzer.MEASURE_VARIANCE.equals(measure)) { final StatisticalSummary summary = getSummary(column, results); return summary.getVariance(); } logger.warn("Encountered non-reduceable measure '{}'. Slave values are: {}", measure, slaveValues); return null; }
@Override protected Serializable reduceValues(List<Object> slaveValues, String column, String measure, Collection<? extends NumberAnalyzerResult> results, Class<?> valueClass) { if (SUM_MEASURES.contains(measure)) { return sum(slaveValues); } else if (NumberAnalyzer.MEASURE_HIGHEST_VALUE.equals(measure)) { return maximum(slaveValues); } else if (NumberAnalyzer.MEASURE_LOWEST_VALUE.equals(measure)) { return minimum(slaveValues); } else if (NumberAnalyzer.MEASURE_MEAN.equals(measure)) { StatisticalSummary summary = getSummary(column, results); return summary.getMean(); } else if (NumberAnalyzer.MEASURE_STANDARD_DEVIATION.equals(measure)) { StatisticalSummary summary = getSummary(column, results); return summary.getStandardDeviation(); } else if (NumberAnalyzer.MEASURE_VARIANCE.equals(measure)) { StatisticalSummary summary = getSummary(column, results); return summary.getVariance(); } logger.warn("Encountered non-reduceable measure '{}'. Slave values are: {}", measure, slaveValues); return null; }
/** * Computes a <a href="http://www.itl.nist.gov/div898/handbook/prc/section2/prc22.htm#formula"> * t statistic </a> to use in comparing the mean of the dataset described by * <code>sampleStats</code> to <code>mu</code>. * <p> * This statistic can be used to perform a one sample t-test for the mean. * </p><p> * <strong>Preconditions</strong>: <ul> * <li><code>observed.getN() > = 2</code>. * </li></ul></p> * * @param mu comparison constant * @param sampleStats DescriptiveStatistics holding sample summary statitstics * @return t statistic * @throws IllegalArgumentException if the precondition is not met */ public double t(double mu, StatisticalSummary sampleStats) throws IllegalArgumentException { if ((sampleStats == null) || (sampleStats.getN() < 2)) { throw new IllegalArgumentException("insufficient data for t statistic"); } return t(sampleStats.getMean(), mu, sampleStats.getVariance(), sampleStats.getN()); }
throw new IllegalArgumentException("insufficient data for t statistic"); return tTest(sampleStats.getMean(), mu, sampleStats.getVariance(), sampleStats.getN());
/** * Computes a <a href="http://www.itl.nist.gov/div898/handbook/prc/section2/prc22.htm#formula"> * t statistic </a> to use in comparing the mean of the dataset described by * <code>sampleStats</code> to <code>mu</code>. * <p> * This statistic can be used to perform a one sample t-test for the mean. * </p><p> * <strong>Preconditions</strong>: <ul> * <li><code>observed.getN() > = 2</code>. * </li></ul></p> * * @param mu comparison constant * @param sampleStats DescriptiveStatistics holding sample summary statitstics * @return t statistic * @throws IllegalArgumentException if the precondition is not met */ public double t(double mu, StatisticalSummary sampleStats) throws IllegalArgumentException { checkSampleData(sampleStats); return t(sampleStats.getMean(), mu, sampleStats.getVariance(), sampleStats.getN()); }
/** * Computes a <a href="http://www.itl.nist.gov/div898/handbook/prc/section2/prc22.htm#formula"> * t statistic </a> to use in comparing the mean of the dataset described by * <code>sampleStats</code> to <code>mu</code>. * <p> * This statistic can be used to perform a one sample t-test for the mean. * </p><p> * <strong>Preconditions</strong>: <ul> * <li><code>observed.getN() > = 2</code>. * </li></ul></p> * * @param mu comparison constant * @param sampleStats DescriptiveStatistics holding sample summary statitstics * @return t statistic * @throws IllegalArgumentException if the precondition is not met */ public double t(double mu, StatisticalSummary sampleStats) throws IllegalArgumentException { checkSampleData(sampleStats); return t(sampleStats.getMean(), mu, sampleStats.getVariance(), sampleStats.getN()); }
/** * Computes the empirical distribution using values from the file * in <code>valuesFileURL</code> and <code>binCount</code> bins. * <p> * <code>valuesFileURL</code> must exist and be readable by this process * at runtime.</p> * <p> * This method must be called before using <code>getNext()</code> * with <code>mode = DIGEST_MODE</code></p> * * @param binCount the number of bins used in computing the empirical * distribution * @throws IOException if an error occurs reading the input file */ public void computeDistribution(int binCount) throws IOException { empiricalDistribution = new EmpiricalDistributionImpl(binCount); empiricalDistribution.load(valuesFileURL); mu = empiricalDistribution.getSampleStats().getMean(); sigma = empiricalDistribution.getSampleStats().getStandardDeviation(); }
/** * Computes the empirical distribution using values from the file * in <code>valuesFileURL</code> and <code>binCount</code> bins. * <p> * <code>valuesFileURL</code> must exist and be readable by this process * at runtime.</p> * <p> * This method must be called before using <code>getNext()</code> * with <code>mode = DIGEST_MODE</code></p> * * @param binCount the number of bins used in computing the empirical * distribution * @throws IOException if an error occurs reading the input file */ public void computeDistribution(int binCount) throws IOException { empiricalDistribution = new EmpiricalDistributionImpl(binCount); empiricalDistribution.load(valuesFileURL); mu = empiricalDistribution.getSampleStats().getMean(); sigma = empiricalDistribution.getSampleStats().getStandardDeviation(); }
throws IllegalArgumentException, MathException { checkSampleData(sampleStats); return tTest(sampleStats.getMean(), mu, sampleStats.getVariance(), sampleStats.getN());
throws IllegalArgumentException, MathException { checkSampleData(sampleStats); return tTest(sampleStats.getMean(), mu, sampleStats.getVariance(), sampleStats.getN());
/** * Computes the empirical distribution using values from the file * in <code>valuesFileURL</code> and <code>binCount</code> bins. * <p> * <code>valuesFileURL</code> must exist and be readable by this process * at runtime.</p> * <p> * This method must be called before using <code>getNext()</code> * with <code>mode = DIGEST_MODE</code></p> * * @param binCount the number of bins used in computing the empirical * distribution * @throws IOException if an error occurs reading the input file */ public void computeDistribution(int binCount) throws IOException { empiricalDistribution = new EmpiricalDistributionImpl(binCount); empiricalDistribution.load(valuesFileURL); mu = empiricalDistribution.getSampleStats().getMean(); sigma = empiricalDistribution.getSampleStats().getStandardDeviation(); }