sample.quantile {LearningStats} | R Documentation |
Sample Quantiles
Description
sample.quantile
computes a estimation of different quantiles, given a sample x, using order statistics.
Usage
sample.quantile(x, tau)
Arguments
x |
a numeric vector containing the sample. |
tau |
the quantile(s) of interest, that must be a number(s) in (0,1). |
Details
A quantile tau
determines the proportion of values in a distribution are above or below a certain limit. For instance, given
tau
a number between 0 and 1, the tau
-quantile splits the sample into tow parts with probabilities tau
and
(1-tau)
, respectively.
One possible way to calculate the quantile tau
would be to ordering the sample
and taking as the quantile the smallest data in the sample (first of the ordered sample)
whose cumulative relative frequency is greater than tau
.
If there is a point in the sample with a cumulative relative frequency equal to tau
,
then the sample quantile will be calculated as the mean between that point and the next one of the ordered sample.
Value
A number or a numeric vector of tau
-quantile(s).
A numerical value or vector corresponding with the requested sample quantiles.
Examples
x=rnorm(20)
sample.quantile(x,tau=0.5)
sample.quantile(x,tau=c(0.25,0.5,0.75))