Empirical quantile
q=quantile(x,p) q=quantile(x,p,method)
a n-by-1 matrix of doubles
a m-by-1 matrix of doubles, the probabilities
a 1-by-1 matrix of doubles, available values are method=1,2,3 (default=1)
a m-by-1 matrix of doubles, the quantiles. q(i)is greater than p(i) percents of the values in x
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).
method=1. Interpolation so that F(X_(k)) == (k-0.5)/n.
method=2. Interpolation so that F(X_(k)) == k/(n+1).
method=3. Based on the empirical distribution.
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) | ![]() | ![]() |