statsmodels.stats.contingency_tables.Table2x2.test_ordinal_association¶
-
Table2x2.
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.
Parameters: row_scores : array-like
An array of numeric row scores
col_scores : array-like
An array of numeric column scores
Returns: 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.
Notes
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.