Dividing values into equal sized groups
Return quantile ranks of the values in a vector based on their sorted order.
usage:
Y = quantileranks(X, q)
Y = quantileranks(X, q, permtie)
X is a vector of values, possibly with NaNs.
q determines quantile class:
q = 4, quartiles ( 4-quantile),
q = 10, deciles (10-quantile),
q = 100, percentiles (100-quantile),
...
permties is a boolean flag to shuffle ranks over duplicate values, ties.
Y is a vector of quantile ranks for the corresponding X values.
example:
>> x=[6 6 3 2 6 6 2 5 NaN 7];
>> [~,ix]=sort(x);
>> y=quantileranks(x,3,0);
>> [x(ix);y(ix)]
ans =
2 2 3 5 6 6 6 6 7 NaN
1 1 1 2 2 2 3 3 3 0
>> tabulate(y)
Value Count Percent
0 1 10.00%
1 3 30.00%
2 3 30.00%
3 3 30.00%
Cite As
Mohammad Rawashdeh (2024). Dividing values into equal sized groups (https://www.mathworks.com/matlabcentral/fileexchange/41266-dividing-values-into-equal-sized-groups), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Language Fundamentals > Data Types > Tables >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |