SquareTable.test_ordinal_association(row_scores=None, col_scores=None)

Assess independence between two ordinal variables.

This is the ‘linear by linear’ association test, which uses weights or scores to target the test to have more power against ordered alternatives.

  • row_scores (array-like) – An array of numeric row scores
  • col_scores (array-like) – An array of numeric column scores

  • A bunch with the following attributes
  • statistic (float) – The test statistic.
  • null_mean (float) – The expected value of the test statistic under the null hypothesis.
  • null_sd (float) – The standard deviation of the test statistic under the null hypothesis.
  • zscore (float) – The Z-score for the test statistic.
  • pvalue (float) – The p-value for the test.


The scores define the trend to which the test is most sensitive.

Using the default row and column scores gives the Cochran-Armitage trend test.