Quantile - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Statistics

  

Quantile

  

compute quantiles

 

Calling Sequence

Parameters

Description

Computation

Data Set Options

Random Variable Options

Examples

References

Compatibility

Calling Sequence

Quantile(A, p, ds_options)

Quantile(X, p, rv_options)

Parameters

A

-

data set or Matrix data set

X

-

algebraic; random variable or distribution

p

-

algebraic; probability

ds_options

-

(optional) equation(s) of the form option=value where option is one of ignore, method, or weights; specify options for computing the quantile of a data set

rv_options

-

(optional) equation of the form numeric=value; specifies options for computing the quantile of a random variable

Description

• 

The Quantile function computes the quantile corresponding to the given probability p for the specified random variable or data set.

• 

For a real valued random variable X with distribution function Fx, and any p between 0 and 1, the pth quantile of X is defined as inf{y|Fyp}. For continuous random variables this is equivalent to the inverse distribution function.

• 

For more details on sample quantiles see option method below.

• 

The first parameter can be a data set (e.g., a Vector), a Matrix data set, a distribution (see Statistics[Distribution]), a random variable, or an algebraic expression involving random variables (see Statistics[RandomVariable]).

• 

The second parameter p is the probability.

Computation

• 

All computations involving data are performed in floating-point; therefore, all data provided must have type/realcons and all returned solutions are floating-point, even if the problem is specified with exact values.

• 

By default, all computations involving random variables are performed symbolically (see option numeric below).

• 

For more information about computation in the Statistics package, see the Statistics[Computation] help page.

Data Set Options

  

The ds_options argument can contain one or more of the options shown below. More information for some options is available in the Statistics[DescriptiveStatistics] help page.

• 

ignore=truefalse -- This option controls how missing data is handled by the Quantile command. Missing items are represented by undefined or Float(undefined). If ignore=false and A contains missing data, the missing data elements will be considered greater than all present data points. If ignore=true all missing items in A will be ignored. The default value is false.

• 

weights=Vector -- Data weights. The number of elements in the weights array must be equal to the number of elements in the original data sample. By default all elements in A are assigned weight 1.

• 

method=integer[1..9] -- Method for calculating the quantiles. Let n denote the number of non-missing elements in A and for i=1..n let Bi denotes the ith order statistic of A. The first two methods for calculating quantiles are defined as follows.

1. 

Bj, where j=np+1;

2. 

Bj, where j=np+12;

9. 

Bj, where j=np+1; unless np+1 is an integer, in which case the result is Bj12+Bj2.

Note that p is converted to a (hardware or software) floating point value before j is computed, which may cause surprising results due to roundoff.

  

The remaining quantiles are calculated in the form Bj+Bj+1Bjr, where j=q, r=fracq, and q is one of the quantities given below.

3. 

q=np;

4. 

q=np+12;

5. 

q=n+1p;

6. 

q=1+n1p;

7. 

q=13+n+13p;  (default method)

8. 

q=38+n+14p.

Random Variable Options

  

The rv_options argument can contain one or more of the options shown below. More information for some options is available in the Statistics[RandomVariables] help page.

• 

numeric=truefalse -- By default, the quantile is computed using exact arithmetic. To compute the quantile numerically, specify the numeric or numeric = true option.

Examples

withStatistics:

Compute the quantile of the Weibull distribution with parameters a and b.

QuantileWeibulla,b,13

aln321b

(1)

Use numeric parameters.

QuantileWeibull3,5,13

3ln3215

(2)

QuantileWeibull3,5,0.3333333333

2.50444761563527

(3)

QuantileWeibull3,5,13,numeric

2.50444761563527

(4)

Generate a random sample of size 100000 drawn from the above distribution and compute the sample quantile.

ASampleWeibull3,5,105:

QuantileA,13

2.50274848246744

(5)

Compute the standard error of the sample quantile for the normal distribution with parameters 5 and 2.

XNormal5,2

XNormal5,2

(6)

BSampleX,106:

QuantileX,13,numeric,StandardError106Quantile,X,13,numeric

4.13854540122573,0.00259298577070808

(7)

QuantileB,13

4.13691708812173

(8)

Create two normal random variables and compute the quantiles of their sum.

XRandomVariableNormal5,2:

YRandomVariableNormal2,5:

QuantileX+Y,13

758+58RootOf3erf_Z+15858

(9)

QuantileX+Y,13,numeric

4.68046250585916

(10)

Verify this using simulation.

CSampleX+Y,106:

QuantileC,13

4.68145838350636

(11)

Compute the quantile of a weighted data set.

Vseqi,i=57..77,undefined:

W2,4,14,41,83,169,394,669,990,1223,1329,1230,1063,646,392,202,79,32,16,5,2,5:

QuantileV,13,weights=W

65.5485434888542

(12)

QuantileV,13,weights=W,ignore=true

65.5538510125591

(13)

Consider the following Matrix data set.

MMatrix3,1130,114694,4,1527,127368,3,907,88464,2,878,96484,4,995,128007

M31130114694415271273683907884642878964844995128007

(14)

We compute the 37 quantile of each of the columns.

QuantileM,37

3.961.476190476190107756.857142857

(15)

References

  

Stuart, Alan, and Ord, Keith. Kendall's Advanced Theory of Statistics. 6th ed. London: Edward Arnold, 1998. Vol. 1: Distribution Theory.

  

Hyndman, R.J., and Fan, Y. "Sample Quantiles in Statistical Packages." American Statistician, Vol. 50. (1996): 361-365.

Compatibility

• 

The A parameter was updated in Maple 16.

See Also

Statistics

Statistics[Computation]

Statistics[CumulativeDistributionFunction]

Statistics[Decile]

Statistics[DescriptiveStatistics]

Statistics[Distributions]

Statistics[ExpectedValue]

Statistics[Percentile]

Statistics[Quartile]

Statistics[RandomVariables]

Statistics[StandardError]