Choosing a measure¶
Start from the question you want to answer. The table gives the measures that answer it, and the notes below help choose among them.
| Question | Measures |
|---|---|
| How likely is \(y\) when \(x\) occurs? | mle |
| How much does knowing \(x\) tell me about \(y\), beyond its base rate? | theil_u, cond_entropy |
| How many fewer prediction errors does knowing \(x\) give? | goodman_kruskal_lambda |
| Do \(x\) and \(y\) co-occur more, or less, than chance predicts? | pmi (signed), fisher odds ratio |
| Is the association statistically significant? | fisher_pvalue, chi2_pvalue, log_likelihood_ratio_pvalue; permutation_pvalue for any measure |
| How strong is the association, on a fixed scale? | cramers_v, normalized_mutual_information, NPMI |
| How much do the occurrences of \(x\) and \(y\) overlap? | jaccard_index |
| How should symbols in an alignment be scored? | tresoldi |
Notes¶
Start with mle and theil_u. The conditional probability is the easiest
to read and to check by hand; Theil's U adds a correction for the base rate,
so a frequent \(y\) does not look predictable from every \(x\). Disagreement
between them usually means that \(y\) is frequent.
Use a signed measure to tell attraction from avoidance. The measures on the pair subset (Theil's U, conditional entropy, mutual information, λ) and the test statistics are unsigned: a pair that never co-occurs can score as high as one that always does. Check the sign of PMI, or the conditional probability, before interpreting a high score. See Pitfalls.
Prefer exact or resampling tests for sparse data. With small counts,
chi-square and G² rely on an approximation that does not hold; use Fisher's
exact test for the 2×2 table, or permutation_pvalue for any measure. See
Test significance and uncertainty.
Smooth or correct when counts are small. Laplace or Lidstone smoothing
stabilizes the conditional probabilities and pmi_smoothed; the Chao–Shen
and NSB estimators reduce the bias of the information-theoretic measures. See
Work with sparse data.
Compare scores within a dataset. PMI, G² and the conditional entropy depend on the sample size or the number of symbols. To compare across datasets, prefer a bounded measure (Theil's U, Cramér's V, NMI) and report the sample sizes.