# Testing for an increasing or decreasing trend across categories

Suppose we have test scores on a set of individuals at various time points and wish to assess if more than would be expected are increasing or decreasing over the course of these time points. We are specifically interested in strict monotonicity in a specified direction. e.g. for three time points t1 < t2 < t3 or t1 > t2 > t3.

We do not allow for ties because this would water down the hypotheses of interest to further include no change between all groups or between subsets of groups as well as increasing or decreasing scores.

We can test the *observed number* of individuals showing a strictly increasing or strictly decreasing set of scores to the *expected number* we would obtain by chance using a chi-square test. This calculation is performed using this spreadsheet.

In particular for N sequences of length k the number expected by chance is $$\frac{N}{k!}$$. We end up with two sets of observed and expected frequencies representing the number of individuals showing either strictly increasing or strictly decreasing trends over time (or some other category) and those who do not. These are then compared using Pearson's chi-square with a significant p-value indicating either greater or fewer occurrences of strictly increasing or strictly decreasing individuals than would be expected by chance.