/** * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getN() */ public synchronized long getN() { return super.getN(); }
/** * {@inheritDoc} */ @Override public synchronized long getN() { return super.getN(); }
/** * {@inheritDoc}. This version returns a count of all the aggregated data. * * @see StatisticalSummary#getN() */ public long getN() { synchronized (statistics) { return statistics.getN(); } }
/** * {@inheritDoc}. This version returns a count of all the aggregated data. * * @see StatisticalSummary#getN() */ public long getN() { synchronized (statistics) { return statistics.getN(); } }
/** * {@inheritDoc} */ @Override public synchronized long getN() { return super.getN(); }
public long getNumberOfSamples() { return statistics.getN(); }
/** * Returns the standard deviation of the values that have been added. * <p> * Double.NaN is returned if no values have been added.</p> * * @return the standard deviation */ public double getStandardDeviation() { double stdDev = Double.NaN; if (getN() > 0) { if (getN() > 1) { stdDev = Math.sqrt(getVariance()); } else { stdDev = 0.0; } } return (stdDev); }
/** * Returns the standard deviation of the values that have been added. * <p> * Double.NaN is returned if no values have been added. * </p> * @return the standard deviation */ public double getStandardDeviation() { double stdDev = Double.NaN; if (getN() > 0) { if (getN() > 1) { stdDev = Math.sqrt(getVariance()); } else { stdDev = 0.0; } } return stdDev; }
/** * Returns the standard deviation of the values that have been added. * <p> * Double.NaN is returned if no values have been added. * </p> * @return the standard deviation */ public double getStandardDeviation() { double stdDev = Double.NaN; if (getN() > 0) { if (getN() > 1) { stdDev = FastMath.sqrt(getVariance()); } else { stdDev = 0.0; } } return stdDev; }
/** * Computes the empirical distribution using data read from a URL. * @param url url of the input file * * @throws IOException if an IO error occurs */ public void load(URL url) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); try { DataAdapter da = new StreamDataAdapter(in); da.computeStats(); if (sampleStats.getN() == 0) { throw MathRuntimeException.createEOFException(LocalizedFormats.URL_CONTAINS_NO_DATA, url); } in = new BufferedReader(new InputStreamReader(url.openStream())); fillBinStats(in); loaded = true; } finally { try { in.close(); } catch (IOException ex) { // ignore } } }
/** * Generates a text report displaying * summary statistics from values that * have been added. * @return String with line feeds displaying statistics * @since 1.2 */ public String toString() { StringBuffer outBuffer = new StringBuffer(); outBuffer.append("SummaryStatistics:\n"); outBuffer.append("n: " + getN() + "\n"); outBuffer.append("min: " + getMin() + "\n"); outBuffer.append("max: " + getMax() + "\n"); outBuffer.append("mean: " + getMean() + "\n"); outBuffer.append("geometric mean: " + getGeometricMean() + "\n"); outBuffer.append("variance: " + getVariance() + "\n"); outBuffer.append("sum of squares: " + getSumsq() + "\n"); outBuffer.append("standard deviation: " + getStandardDeviation() + "\n"); outBuffer.append("sum of logs: " + getSumOfLogs() + "\n"); return outBuffer.toString(); }
public GaugeMetricValue build() { return new GaugeMetricValue(valueRange, stats.getMin(), stats.getMax(), stats.getN(), Double.isNaN(stats.getSum()) ? 0.0 : stats.getSum(), Double.isNaN(stats.getSumsq()) ? 0.0 : stats.getSumsq(), accum.getSparseHistogram()); } }
/** * Pretty print a time * @param ss the stats defining the time * @return a string representing the time */ public static String format(SummaryStatistics ss) { if (ss.getN() == 1) { return formatTime(ss.getMean()); } return formatTime(ss.getMean(), ss.getStandardDeviation()); }
/** * Pretty print a time * @param ss the stats defining the time * @return a string representing the time */ public static String format(SummaryStatistics ss) { if (ss.getN() == 1) { return formatTime(ss.getMean()); } return formatTime(ss.getMean(), ss.getStandardDeviation()); }
/** * Return a {@link StatisticalSummaryValues} instance reporting current * statistics. * * @return Current values of statistics */ public StatisticalSummary getSummary() { return new StatisticalSummaryValues(getMean(), getVariance(), getN(), getMax(), getMin(), getSum()); }
/** * Return a {@link StatisticalSummaryValues} instance reporting current * statistics. * @return Current values of statistics */ public StatisticalSummary getSummary() { return new StatisticalSummaryValues(getMean(), getVariance(), getN(), getMax(), getMin(), getSum()); }
/** * Return a {@link StatisticalSummaryValues} instance reporting current * statistics. * @return Current values of statistics */ public StatisticalSummary getSummary() { return new StatisticalSummaryValues(getMean(), getVariance(), getN(), getMax(), getMin(), getSum()); }
/** * Returns hash code based on values of statistics * @return hash code */ @Override public int hashCode() { int result = 31 + MathUtils.hash(getGeometricMean()); result = result * 31 + MathUtils.hash(getGeometricMean()); result = result * 31 + MathUtils.hash(getMax()); result = result * 31 + MathUtils.hash(getMean()); result = result * 31 + MathUtils.hash(getMin()); result = result * 31 + MathUtils.hash(getN()); result = result * 31 + MathUtils.hash(getSum()); result = result * 31 + MathUtils.hash(getSumsq()); result = result * 31 + MathUtils.hash(getVariance()); return result; }
/** * Returns hash code based on values of statistics * @return hash code */ @Override public int hashCode() { int result = 31 + MathUtils.hash(getGeometricMean()); result = result * 31 + MathUtils.hash(getGeometricMean()); result = result * 31 + MathUtils.hash(getMax()); result = result * 31 + MathUtils.hash(getMean()); result = result * 31 + MathUtils.hash(getMin()); result = result * 31 + MathUtils.hash(getN()); result = result * 31 + MathUtils.hash(getSum()); result = result * 31 + MathUtils.hash(getSumsq()); result = result * 31 + MathUtils.hash(getVariance()); return result; }
/** * Returns hash code based on values of statistics * * @return hash code */ public int hashCode() { int result = 31 + MathUtils.hash(getGeometricMean()); result = result * 31 + MathUtils.hash(getGeometricMean()); result = result * 31 + MathUtils.hash(getMax()); result = result * 31 + MathUtils.hash(getMean()); result = result * 31 + MathUtils.hash(getMin()); result = result * 31 + MathUtils.hash(getN()); result = result * 31 + MathUtils.hash(getSum()); result = result * 31 + MathUtils.hash(getSumsq()); result = result * 31 + MathUtils.hash(getVariance()); return result; }