How to compute the sum of ranks for each related group

Sum of ranks in group $i$

  1. Arrange your data in an $N \times k$ matrix, where the $N$ rows represent the $N$ blocks (usually the subjects), and the $k$ columns represent the $k$ related groups (usually the repeated measurements)
  2. For each row (subject) separately, arrange the observations from smallest to largest. The rank of an observation is its position in this ordered list. If there are ties, assign them the average of the ranks they occupy
  3. The sum of ranks in group $i$ is the sum of rank scores in that group. That is, the sum of ranks in group $i$ is the sum of all the rank scores in the column for group $i$