I have an n
-by-1
vector where n = 20000
. I would like to do a decile ranking for the data in this vector, which is basically replacing the value of each element by its corresponding decile.
I am currently doing it this way:
deciles = quantile(X,9);
X = discretize(X,[-inf deciles inf]);
Where X
is my array of data. I'm doing this because I want to have 10 groups of data with the same number in each of them.
Can you validate this procedure or let me know if there is a more robust way to do so?