<< ksdensity_kernelpdf Miscellaneous stixbox_getpath >>

Stixbox >> Stixbox > Miscellaneous > quantile

quantile

Empirical quantile

Calling Sequence

q=quantile(x,p)
q=quantile(x,p,method)

Parameters

x :

a n-by-1 matrix of doubles

p :

a m-by-1 matrix of doubles, the probabilities

method :

a 1-by-1 matrix of doubles, available values are method=1,2,3 (default=1)

q :

a m-by-1 matrix of doubles, the quantiles. q(i)is greater than p(i) percents of the values in x

Description

The empirical quantile of the sample x, a value that is greater than p percent of the values in x If input x is a matrix then the quantile is computed for every column. If p is a vector then q is a matrix, each line contain the quantiles computed for a value of p.

The empirical quantile is computed by one of three ways determined by a third input argument (with default 1).

Examples

x=[
0.4827129   0.3431706  -0.4127328    0.3843994
-0.7107495  -0.2547306   0.0290803    0.1386087
-0.7698385   1.0743628   1.0945652    0.4365680
-0.5913411  -0.7426987   1.609719     0.8079680
-2.1700554  -0.7361261   0.0069708    1.4626386
];
// Make a column vector:
x=x(:);
p=linspace(0.1,0.9,10)';
q=quantile(x,p) // Same as : q=quantile(x,p,1)
// Check the property
p(1)
length(find(x<q(1)))/length(x)
p(5)
length(find(x<q(5)))/length(x)
q=quantile(x,p,2)
q=quantile(x,p,3)

Authors


Report an issue
<< ksdensity_kernelpdf Miscellaneous stixbox_getpath >>