# Movements within a distribution

I'm interested how elements in a distribution change (or churn) over time. For example if we follow pupils’ grades over time, and we can draw the distribution in each period and see its aggregate moments. But can we tell if the pupil who achieved in the top percentile in, say, year t was also in the same position (or same percentile) in year t+h?

Are there formal metrics in this regards -- like switching probabilities, measures of churn or inter-quartile movements? Thanks

• Google 'churn rate' and you will find many interpretations of what that should mean. In combinatorics there is a term 'derangements' (roughly the number of position swaps required to get back to an 'original' order). Before you can get a descriptive statistic for this, I think it would be helpful to have a clearer English description of what you mean by churn. To start, are are you interested only in how rankings change within a fixed group, or in how the membership of the group changes? – BruceET Sep 11 at 18:18

One idea. If it is along useful lines, fine. If not, an explanation of why not, might help to clarify your question. You have 30 students. Consider 1 to 10 'top', 11 to 20 'middle', 21 to 30 'bottom'.

Let's randomly scramble the 'middle' group. Then take the Spearman correlation $$r_S$$ of the two orders; $$-1 \le r_S \le 1.$$ Larger $$r_S$$ indicates smaller amount of churn. (Computations and graphs from R.)

set.seed(2019)
x1 = 1:30;  x2 = c(1:10, sample(11:20), 21:30)
cor(x1, x2, meth="sp")
[1] 0.9630701

set.seed(1776)
x1 = 1:30;  x2 = c(1:10, sample(11:20), 21:30)
cor(x1, x2, meth="sp")
[1] 0.971079


Contrast these results with results from randomly scrambing the 'top' and 'middle' together.

set.seed(1066)
x1 = 1:30;  x2 = c(sample(1:20), 21:30)
cor(x1, x2, meth="sp")
[1] 0.7619577


What happens if we scramble the top and bottom groups separately, and then switch them?

set.seed(1015)
x1 = 1:30;  x2 = c(sample(21:30), 11:20, sample(1:10))
cor(x1, x2, meth="sp")
[1] -0.8723026


And finally, see what happens if we randomly scramble the whole group of 30?

set.seed(1492)
x1 = 1:30;  x2 = sample(1:30)
cor(x1, x2, meth="sp")
[1] 0.4576196