Contingency table functions (scipy.stats.contingency)

Functions for creating and analyzing contingency tables.

chi2_contingency(observed[, correction, lambda_])

Chi-square test of independence of variables in a contingency table.

relative_risk(exposed_cases, exposed_total, …)

Compute the relative risk (also known as the risk ratio).

crosstab(*args[, levels, sparse])

Return table of counts for each possible unique combination in *args.

association(observed[, method, correction, …])

Calculates degree of association between two nominal variables.


Compute the expected frequencies from a contingency table.


Return a list of the marginal sums of the array a.