org.apache.commons.math.stat.univariate.rank
Class Percentile

java.lang.Object
  extended byorg.apache.commons.math.stat.univariate.AbstractUnivariateStatistic
      extended byorg.apache.commons.math.stat.univariate.rank.Percentile
All Implemented Interfaces:
Serializable, UnivariateStatistic
Direct Known Subclasses:
Median

public class Percentile
extends AbstractUnivariateStatistic
implements Serializable

Version:
$Revision: 1.11 $ $Date: 2003/11/19 03:28:24 $
See Also:
Serialized Form

Constructor Summary
Percentile()
          Constructs a Percentile with a default percentile value of 50.0.
Percentile(double p)
          Constructs a Percentile with the specific percentile value.
 
Method Summary
 double evaluate(double[] values, double p)
          Evaluates the double[] top the specified percentile.
 double evaluate(double[] values, int start, int length)
          Subclasses of AbstractUnivariateStatistc need to implement this method.
 double evaluate(double[] values, int begin, int length, double p)
          Evaluates the double[] top the specified percentile.
 double getPercentile()
          The default internal state of this percentile can be set.
 void setPercentile(double p)
          The default internal state of this percentile can be set.
 
Methods inherited from class org.apache.commons.math.stat.univariate.AbstractUnivariateStatistic
evaluate, test
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Percentile

public Percentile()
Constructs a Percentile with a default percentile value of 50.0.


Percentile

public Percentile(double p)
Constructs a Percentile with the specific percentile value.

Parameters:
p - the percentile
Method Detail

evaluate

public double evaluate(double[] values,
                       double p)
Evaluates the double[] top the specified percentile. This does not alter the interal percentile state of the statistic.

Parameters:
values - Is a double[] containing the values
p - Is the percentile to evaluate to.
Returns:
the result of the evaluation or Double.NaN if the array is empty

evaluate

public double evaluate(double[] values,
                       int start,
                       int length)
Description copied from class: AbstractUnivariateStatistic
Subclasses of AbstractUnivariateStatistc need to implement this method.

Specified by:
evaluate in interface UnivariateStatistic
Specified by:
evaluate in class AbstractUnivariateStatistic
See Also:
UnivariateStatistic.evaluate(double[], int, int)

evaluate

public double evaluate(double[] values,
                       int begin,
                       int length,
                       double p)
Evaluates the double[] top the specified percentile. This does not alter the interal percentile state of the statistic.

Parameters:
values - Is a double[] containing the values
begin - processing at this point in the array
length - processing at this point in the array
p - Is the percentile to evaluate to.*
Returns:
the result of the evaluation or Double.NaN if the array is empty

getPercentile

public double getPercentile()
The default internal state of this percentile can be set. This will return that value.

Returns:
percentile

setPercentile

public void setPercentile(double p)
The default internal state of this percentile can be set. This will setthat value.

Parameters:
p - a value between 0 <= p <= 100


Copyright © 2003-2004 Apache Software Foundation. All Rights Reserved.