Quantiles in Matlab -
would there function in matlab, or easy way, generate quantile groups each data point belongs to?
example:
x = [4 0.5 3 5 1.2]; q = quantile(x, 3); ans = 1.0250 3.0000 4.2500
so see following:
result = [2 1 2 3 1]; % quantile groups
in other words, looking equivalent of thread in matlab
thanks!
you can go through n
quantiles in loop , use logical indexing find quantile
n = 3; q = quantile(x,n); y = ones(size(x)); k=2:n y(x>=q(k)) = k; end
Comments
Post a Comment