Suppose that subject j (belonging to a particular group) has a value that is ranked rj amongst the n values being considered. The G groups are supposed to be ordered (for example, the classes in a school) and a score is awarded to each according to its position in that order. Typically these are the scores 1, 2,…, G. The test statistic is the sum, over all subjects, of the product of the rank and the group score.