/** * {@inheritDoc} */ @Override public StorelessUnivariateStatistic copy() { // multiply quantile by 100 now as anyway constructor divides it by 100 PSquarePercentile copy = new PSquarePercentile(100d * quantile); if (markers != null) { copy.markers = (PSquareMarkers) markers.clone(); } copy.countOfObservations = countOfObservations; copy.pValue = pValue; copy.initialFive.clear(); copy.initialFive.addAll(initialFive); return copy; }
/** * @return maximum in the data set added to this statistic */ private double maximum() { double val = Double.NaN; if (markers != null) { val = markers.height(PSQUARE_CONSTANT); } else if (!initialFive.isEmpty()) { val = initialFive.get(initialFive.size() - 1); } return val; }
/** * {@inheritDoc}The internal state updated due to the new value in this * context is basically of the marker positions and computation of the * approximate quantile. * * @param observation the observation currently being added. */ @Override public void increment(final double observation) { // Increment counter countOfObservations++; // Store last observation this.lastObservation = observation; // 0. Use Brute force for <5 if (markers == null) { if (initialFive.add(observation)) { Collections.sort(initialFive); pValue = initialFive .get((int) (quantile * (initialFive.size() - 1))); return; } // 1. Initialize once after 5th observation markers = newMarkers(initialFive, quantile); } // 2. process a Data Point and return pValue pValue = markers.processDataPoint(observation); }
/** * {@inheritDoc}The internal state updated due to the new value in this * context is basically of the marker positions and computation of the * approximate quantile. * * @param observation the observation currently being added. */ @Override public void increment(final double observation) { // Increment counter countOfObservations++; // Store last observation this.lastObservation = observation; // 0. Use Brute force for <5 if (markers == null) { if (initialFive.add(observation)) { Collections.sort(initialFive); pValue = initialFive .get((int) (quantile * (initialFive.size() - 1))); return; } // 1. Initialize once after 5th observation markers = newMarkers(initialFive, quantile); } // 2. process a Data Point and return pValue pValue = markers.processDataPoint(observation); }
/** * {@inheritDoc} */ @Override public StorelessUnivariateStatistic copy() { // multiply quantile by 100 now as anyway constructor divides it by 100 PSquarePercentile copy = new PSquarePercentile(100d * quantile); if (markers != null) { copy.markers = (PSquareMarkers) markers.clone(); } copy.countOfObservations = countOfObservations; copy.pValue = pValue; copy.initialFive.clear(); copy.initialFive.addAll(initialFive); return copy; }
/** * @return minimum in the data set added to this statistic */ private double minimum() { double val = Double.NaN; if (markers != null) { val = markers.height(1); } else if (!initialFive.isEmpty()) { val = initialFive.get(0); } return val; }
/** * @return maximum in the data set added to this statistic */ private double maximum() { double val = Double.NaN; if (markers != null) { val = markers.height(PSQUARE_CONSTANT); } else if (!initialFive.isEmpty()) { val = initialFive.get(initialFive.size() - 1); } return val; }
/** * @return minimum in the data set added to this statistic */ private double minimum() { double val = Double.NaN; if (markers != null) { val = markers.height(1); } else if (!initialFive.isEmpty()) { val = initialFive.get(0); } return val; }