Skip to main content

Module contingency

Module contingency 

Source
Expand description

Effect sizes for contingency tables (SciPy’s odds_ratio, relative_risk and contingency.association), with confidence intervals.

See the book entry Multivariate distributions and further tests.

Structs§

OddsRatioResult
The result of odds_ratio.
RelativeRiskResult
The result of relative_risk.

Enums§

AssociationMethod
A measure of association for an r × c table (SciPy’s association’s method).
OddsRatioKind
Which odds ratio odds_ratio estimates (SciPy’s kind).

Functions§

association
The strength of association between the two variables of a contingency table (SciPy’s contingency.association), from φ² = χ²/N without continuity correction: 0 for independence, 1 (for Cramér’s V and Tschuprow’s T on square tables) for perfect association.
odds_ratio
The odds ratio of a 2 × 2 table [[a, b], [c, d]] (SciPy’s odds_ratio). The conditional estimate solves E_ω[X] = a for the odds ratio ω of Fisher’s noncentral hypergeometric distribution of X = table[0][0] given all margins; its confidence limits invert that distribution’s tails (the exact interval that matches Fisher’s exact test). The sample odds ratio is ad/(bc), with Woolf’s interval exp(log OR ± z √(1/a + 1/b + 1/c + 1/d)).
relative_risk
The relative risk (a/n₁)/(c/n₂) of a cases among n₁ exposed and c among n₂ controls (SciPy’s relative_risk).