Page's L test - mauriceling/mauriceling.github.io GitHub Wiki

Purpose: To test whether there is a trend between different treatments. For example, is Treatment 1 better than Treatment 2 which in turn is better than Treatment3?

Null hypothesis: All treatments are equal.

Alternate hypothesis: Treatment 1 ≥ Treatment 2 ≥ ... ≥ Treatment N

Code 1: Where each row represents an observer scoring for treatments (as column). For example, a taster (1 row per taster) is asked to score on a 5-point scale on 3 different foods (1 column per food), and the alternate hypothesis (in predicted_ranks) is Food A ≥ Food B ≥ Food C.

>>> from scipy import stats
>>> table = [[4, 3, 1],
             [3, 4, 1],
             [5, 3, 3],
             [4, 3, 1]]
>>> result = stats.page_trend_test(table, ranked=False, predicted_ranks=[3, 2, 1])
>>> print("L = %.2f" % result.statistic)
L = 54.50
>>> print("p-value = %.2f" % result.pvalue)
p-value = 0.03

Code 2: Where each row represents an observer scoring for treatments (as column). For example, a taster (1 row per taster) is asked to rank 3 different foods (1 column per food) where 3=best to 1=worst, and the alternate hypothesis (in predicted_ranks) is Food A ≥ Food B ≥ Food C.

>>> from scipy import stats
>>> table = [[3, 2, 1],
             [2, 3, 1],
             [3, 2, 1],
             [1, 2, 1]]
>>> result = stats.page_trend_test(table, ranked=True, predicted_ranks=[3, 2, 1])
>>> print("L = %.2f" % result.statistic)
L = 49.00
>>> print("p-value = %.2f" % result.pvalue)
p-value = 0.42

References:

  1. Ellis Batten Page, “Ordered hypotheses for multiple treatments: a significant test for linear ranks”, Journal of the American Statistical Association 58(301), p. 216–230, 1963.