@Override public Number getExpectedValue(int start, int length) { if (length < 2) { return null; } double[] values = new double[length]; for (int i = 0; i < length; i++) { values[i] = start + i; } StandardDeviation stdDev = new StandardDeviation(); return stdDev.evaluate(values); }
synchronized void recordTiming(long timeNanos) { meanTimeNanos.increment(timeNanos); stdevTimeNanos.increment(timeNanos); }
/** * Copies source to dest. * <p>Neither source nor dest can be null.</p> * * @param source StandardDeviation to copy * @param dest StandardDeviation to copy to * @throws NullArgumentException if either source or dest is null */ public static void copy(StandardDeviation source, StandardDeviation dest) throws NullArgumentException { MathUtils.checkNotNull(source); MathUtils.checkNotNull(dest); dest.setData(source.getDataRef()); dest.variance = source.variance.copy(); }
/** * {@inheritDoc} */ @Override public StandardDeviation copy() { StandardDeviation result = new StandardDeviation(); // No try-catch or advertised exception because args are guaranteed non-null copy(this, result); return result; }
static private Double evaluate(Collection<?> values, boolean biasCorrected){ StandardDeviation statistic = new StandardDeviation(); statistic.setBiasCorrected(biasCorrected); for(Object value : values){ Double doubleValue = (Double)TypeUtil.parseOrCast(DataType.DOUBLE, value); statistic.increment(doubleValue); } return statistic.getResult(); } }
protected Endpoint(String path, double relativeProb) { Preconditions.checkArgument(relativeProb > 0.0); this.path = path; this.relativeProb = relativeProb; meanTimeNanos = new Mean(); stdevTimeNanos = new StandardDeviation(); }
public void summarize(double[] x, int[] y){ if(x.length!=y.length) throw new IllegalArgumentException("X and Y are of different lengths."); N = (double) x.length; Mean meanX = new Mean(); StandardDeviation sdX = new StandardDeviation(); PearsonCorrelation rxy = new PearsonCorrelation(); Frequency table = new Frequency(); for(int i=0;i<N;i++){ meanX.increment(x[i]); sdX.increment(x[i]); rxy.increment(x[i], (double)y[i]); table.addValue(y[i]); } //compute thresholds int nrow = table.getUniqueCount(); double[] freqDataY = new double[nrow]; double ntotal = table.getSumFreq(); for(int i=0;i<(nrow-1);i++){ freqDataY[i] = table.getCumFreq(i+1); thresholds[i] = norm.inverseCumulativeProbability(freqDataY[i]/ntotal); } thresholds[nrow-1] = 10;//set last threshold to a large number less than infinity }
private void evaluate(){ Mean mX = new Mean(); StandardDeviation sdX = new StandardDeviation(populationStdDev); Mean mY = new Mean(); StandardDeviation sdY = new StandardDeviation(populationStdDev); ItemResponseModel irmX; ItemResponseModel irmY; for(VariableName v : sY){ irmX = itemFormX.get(v); irmY = itemFormY.get(v); irmX.incrementMeanSigma(mX, sdX); irmY.incrementMeanSigma(mY, sdY); } if(checkRaschModel()){ slope = 1.0; }else{ slope = sdY.getResult() / sdX.getResult(); } intercept = mY.getResult()-slope*mX.getResult(); }
Max max = new Max(); Mean mean = new Mean(); StandardDeviation sd = new StandardDeviation(); max.increment(x[i]); mean.increment(x[i]); sd.increment(x[i]); binCalc = new ScottBinCalculation(n, min.getResult(), max.getResult(), sd.getResult()); }else if(binCalculationType== BinCalculationType.FREEDMAN_DIACONIS){ Percentile percentile = new Percentile();
public double getStdDev() { return sd.getResult(); }
velocityToOrientationQualityStandardDeviationCalculator.increment(orientationVelocityConsistency.getCorrelation(currentDirection)); velocityToOrientationQualityStandardDeviation.set(velocityToOrientationQualityStandardDeviationCalculator.getResult()); velocityToOrientationDelayStandardDeviationCalculator.increment(orientationVelocityConsistency.getEstimatedDelay(currentDirection)); velocityToOrientationDelayStandardDeviation.set(velocityToOrientationDelayStandardDeviationCalculator.getResult()); velocityIMUVsJointQualityStandardDeviationCalculator.increment(delayEstimator.getCorrelationCoefficient()); velocityIMUVsJointQualityStandardDeviation.set(velocityIMUVsJointQualityStandardDeviationCalculator.getResult()); velocityIMUVsJointDelayStandardDeviationCalculator.increment(delayEstimator.getEstimatedDelay()); velocityIMUVsJointDelayStandardDeviation.set(velocityIMUVsJointDelayStandardDeviationCalculator.getResult());
private void print(int indent, String header, TimingResults timings) { String msg = String.format("" + "Mean: % 7.2f ms\n" + "Median: % 7.2f ms\n" + "StdDev: % 7.2f ms", timings.mean.evaluate() * 1000.0, timings.median.evaluate() * 1000.0, timings.stddev.evaluate() * 1000.0); System.out.println(StringTools.indent(header + ":", StringTools.strrep(' ', indent))); System.out.println(StringTools.indent(msg, StringTools.strrep(' ', indent + 2))); }
private TimingResults timeIt(RunMe runMe, int iterations) { double[] values = new double[iterations]; for (int i = 0; i < iterations; ++i) values[i] = timeIt(runMe); TimingResults results = new TimingResults(); results.mean.setData(values); results.median.setData(values); results.stddev.setData(values); return results; }
static private Double evaluate(Collection<?> values, boolean biasCorrected){ StandardDeviation statistic = new StandardDeviation(); statistic.setBiasCorrected(biasCorrected); for(Object value : values){ Number number = (Number)TypeUtil.parseOrCast(DataType.DOUBLE, value); statistic.increment(number.doubleValue()); } return statistic.getResult(); } }
public StdDev() { super(new org.apache.commons.math3.stat.descriptive.moment.StandardDeviation()); } }
/** * {@inheritDoc} */ @Override public StandardDeviation copy() { StandardDeviation result = new StandardDeviation(); // No try-catch or advertised exception because args are guaranteed non-null copy(this, result); return result; }
public void summarize()throws DimensionMismatchException{ if(dataX.length!=dataY.length) throw new DimensionMismatchException(dataX.length, dataY.length); Frequency table = new Frequency(); meanX = new Mean(); sdX = new StandardDeviation(); rxy = new PearsonCorrelation(); for(int i=0;i<nrow;i++){ meanX.increment(dataX[i]); sdX.increment(dataX[i]); rxy.increment(dataX[i], (double)dataY[i]); table.addValue(dataY[i]); } //compute thresholds nrow = table.getUniqueCount(); freqDataY = new double[nrow]; double ntotal = table.getSumFreq(); for(int i=0;i<(nrow-1);i++){ freqDataY[i] = table.getCumFreq(i+1); alpha[i] = normal.inverseCumulativeProbability(freqDataY[i]/ntotal); } alpha[nrow-1] = 10;//set last threshold to a large number less than infinity }
public double getStdDev(){ return sd.getResult(); }
velocityToOrientationQualityStandardDeviationCalculator.increment(orientationVelocityConsistency.getCorrelation(currentAxis)); velocityToOrientationQualityStandardDeviation.set(velocityToOrientationQualityStandardDeviationCalculator.getResult()); velocityToOrientationDelayStandardDeviationCalculator.increment(orientationVelocityConsistency.getEstimatedDelay(currentAxis)); velocityToOrientationDelayStandardDeviation.set(velocityToOrientationDelayStandardDeviationCalculator.getResult()); velocityIMUVsJointQualityStandardDeviationCalculator.increment(delayEstimator.getCorrelationCoefficient()); velocityIMUVsJointQualityStandardDeviation.set(velocityIMUVsJointQualityStandardDeviationCalculator.getResult()); velocityIMUVsJointDelayStandardDeviationCalculator.increment(delayEstimator.getEstimatedDelay()); velocityIMUVsJointDelayStandardDeviation.set(velocityIMUVsJointDelayStandardDeviationCalculator.getResult());