As we know, quantile
function is the inverse cumulative distribution function.
Then for an existed distribute(a vector), how to exactly match the result of cumulative distribution function
and quantile
function?
Here is an example given in MATLAB.
a = [150 154 151 153 124]
[x_count, x_val] = hist(a, unique(a));
% compute the probability cumulative distribution
p = cumsum(n)/sum(n);
x_out = quantile(a, p)
In the cumulative distribution function, the corresponding relation between cumulative probability and x value should be:
x = 124 150 151 153 154
p = 0.2000 0.4000 0.6000 0.8000 1.0000
But use p and quantile to compute x_out, the result is different with x:
x_out =
137.0000 150.5000 152.0000 153.5000 154.0000
Reference