# statsmodels.stats.contingency_tables.Table¶

class statsmodels.stats.contingency_tables.Table(table, shift_zeros=True)[source]

A two-way contingency table.

Parameters
tablearray-like

A contingency table.

shift_zerosboolean

If True and any cell count is zero, add 0.5 to all values in the table.

statsmodels.graphics.mosaicplot.mosaic, scipy.stats.chi2_contingency

Notes

The inference procedures used here are all based on a sampling model in which the units are independent and identically distributed, with each unit being classified with respect to two categorical variables.

References

Definitions of residuals:

https://onlinecourses.science.psu.edu/stat504/node/86

Attributes
table_origarray-like

The original table is cached as table_orig.

Methods

 Returns the contributions to the chi^2 statistic for independence. Returns cumulative log odds ratios. Returns the cumulative odds ratios for a contingency table. Returns fitted cell counts under independence. from_data(data[, shift_zeros]) Construct a Table object from data. Returns fitted joint probabilities under independence. Returns local log odds ratios. Returns local odds ratios. Estimate marginal probability distributions for the rows and columns. Returns Pearson residuals. Returns standardized residuals under independence. Assess independence for nominal factors. test_ordinal_association([row_scores, …]) Assess independence between two ordinal variables.