|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.stats.descriptive.rank.Quantile
public class Quantile
Quantiles are points taken at regular intervals from the cumulative distribution function (CDF) of a random variable. Dividing ordered data into q essentially equal-sized data subsets is the motivation for q-quantiles; the quantiles are the data values marking the boundaries between consecutive subsets. Put another way, the k-th q-quantile for a random variable is the value x such that the probability that the random variable will be less than x is at most k/q and the probability that the random variable will be more than x is at most (q - k)/q. There are q-1 q-quantiles, with k an integer satisfying 0 < k < q.
The smallest observation corresponds to probability 0 and the largest probability 1.
This class implements the 9 different quantile definitions in Hyndman 1996.
The R equivalent function is quantile.
| Nested Class Summary | |
|---|---|
static class |
Quantile.Type
the quantile definitions available For details, please refer to Sample quantiles in statistical packages by Hyndman, R. |
| Field Summary | |
|---|---|
Quantile.Type |
type
the quantile definition |
| Constructor Summary | |
|---|---|
Quantile(double[] data)
Construct a Quantile instance using the default type: APPROXIMATELY_MEDIAN_UNBIASED. |
|
Quantile(double[] data,
Quantile.Type type)
Construct a Quantile instance. |
|
| Method Summary | |
|---|---|
void |
addData(double... data)
Recompute the statistic, incrementally if possible. |
long |
N()
Get the size of the sample. |
double |
value()
Get the value of the statistic. |
double |
value(double q)
Compute the sample value corresponding to a probability. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final Quantile.Type type
| Constructor Detail |
|---|
public Quantile(double[] data,
Quantile.Type type)
data - the datatype - the algorithm to compute Q(q)public Quantile(double[] data)
data - the data| Method Detail |
|---|
public void addData(double... data)
Statistic
addData in interface Statisticdata - an array of new itemspublic double value()
Statistic
value in interface Statisticpublic double value(double q)
q - a quantile
q quantilepublic long N()
Statistic
N in interface Statistic
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||