Dividing values into equal sized groups

Distribute values, as evenly as possible, over quantile rank groups.

Vous suivez désormais cette soumission

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%

Citation pour cette source

Mohammad Rawashdeh (2026). Dividing values into equal sized groups (https://fr.mathworks.com/matlabcentral/fileexchange/41266-dividing-values-into-equal-sized-groups), MATLAB Central File Exchange. Extrait(e) le .

Informations générales

Compatibilité avec les versions de MATLAB

  • Compatible avec toutes les versions

Plateformes compatibles

  • Windows
  • macOS
  • Linux
Version Publié le Notes de version Action
1.0.0.0