/** * Copy constructor, creates a new {@code Min} identical * to the {@code original} * * @param original the {@code Min} instance to copy * @throws NullArgumentException if original is null */ public Min(Min original) throws NullArgumentException { copy(original, this); }
/** * Returns the percentile computed thus far. * * @return height of mid point marker */ public double getPercentileValue() { return height(3); }
/** {@inheritDoc} */ @Override public Median withNaNStrategy(final NaNStrategy newNaNStrategy) { return new Median(getEstimationType(), newNaNStrategy, getKthSelector()); }
/** {@inheritDoc} */ @Override public Median withKthSelector(final KthSelector newKthSelector) { return new Median(getEstimationType(), getNaNStrategy(), newKthSelector); }
/** {@inheritDoc} */ @Override public Median withEstimationType(final EstimationType newEstimationType) { return new Median(newEstimationType, getNaNStrategy(), getKthSelector()); }
/** * {@inheritDoc} */ @Override public Percentile copy() { return new Percentile(this); }
/** * Returns the result of evaluating the statistic over the stored data. * <p> * The stored array is the one which was set by previous calls to * {@link #setData(double[])} * </p> * @param p the percentile value to compute * @return the value of the statistic applied to the stored data * @throws MathIllegalArgumentException if p is not a valid quantile value * (p must be greater than 0 and less than or equal to 100) */ public double evaluate(final double p) throws MathIllegalArgumentException { return evaluate(getDataRef(), p); }
/** * {@inheritDoc}.Clone Markers * * @return cloned object */ @Override public Object clone() { return new Markers(new Marker[] { new Marker(), (Marker) markerArray[1].clone(), (Marker) markerArray[2].clone(), (Marker) markerArray[3].clone(), (Marker) markerArray[4].clone(), (Marker) markerArray[5].clone() }); }
/** * {@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; }
/** * Copy constructor, creates a new {@code Max} identical * to the {@code original} * * @param original the {@code Max} instance to copy * @throws NullArgumentException if original is null */ public Max(Max original) throws NullArgumentException { copy(original, this); }
/** * Evaluate method to compute the percentile for a given bounded array. * This basically calls the {@link #index(double, int) index} and then * {@link #estimate(double[], int[], double, int, KthSelector) estimate} * functions to return the estimated percentile value. Please * note that this method does not make use of cached pivots. * * @param work array of numbers to be used for finding the percentile * @param p the p<sup>th</sup> quantile to be computed * @return estimated percentile * @param selector a {@link KthSelector} used for pivoting during search * @throws OutOfRangeException if length or p is out of range * @throws NullArgumentException if work array is null */ public double evaluate(final double[] work, final double p, final KthSelector selector) { return this.evaluate(work, null, p, selector); }
/** * {@inheritDoc}This method in particular for R_1 uses ceil(pos-0.5) */ @Override protected double estimate(final double[] values, final int[] pivotsHeap, final double pos, final int length, final KthSelector selector) { return super.estimate(values, pivotsHeap, FastMath.ceil(pos - 0.5), length, selector); }
/** * Adjust marker heights by setting quantile estimates to middle markers. */ private void adjustHeightsOfMarkers() { for (int i = LOW; i <= HIGH; i++) { estimate(i); } }
/** * Constructor * * @param initialFive elements required to build Marker * @param p quantile required to be computed */ private Markers(final List<Double> initialFive, final double p) { this(createMarkerArray(initialFive, p)); }
/** * Clone this instance. * * @return cloned marker */ @Override public Object clone() { return new Marker(markerHeight, desiredMarkerPosition, desiredMarkerIncrement, intMarkerPosition); }
/** * A creation method to build Markers * * @param initialFive list of initial five elements * @param p the quantile desired * @return an instance of PSquareMarkers */ public static PSquareMarkers newMarkers(final List<Double> initialFive, final double p) { return new Markers(initialFive, p); }
public PercentileMetricAnomalyFinder() { _percentile = new Percentile(); }