statsmodels.stats.contingency_tables.StratifiedTable

class statsmodels.stats.contingency_tables.StratifiedTable(tables, shift_zeros=False)[source]

Analyses for a collection of 2x2 contingency tables.

Such a collection may arise by stratifying a single 2x2 table with respect to another factor. This class implements the ‘Cochran-Mantel-Haenszel’ and ‘Breslow-Day’ procedures for analyzing collections of 2x2 contingency tables.

Parameters
tableslist or ndarray

Either a list containing several 2x2 contingency tables, or a 2x2xk ndarray in which each slice along the third axis is a 2x2 contingency table.

Notes

This results are based on a sampling model in which the units are independent both within and between strata.

Attributes
logodds_pooled

Returns the logarithm of the pooled odds ratio.

See oddsratio_pooled for more information.

logodds_pooled_se

Estimated standard error of the pooled log odds ratio

J. Robins, N. Breslow, S. Greenland. “Estimators of the Mantel-Haenszel Variance Consistent in Both Sparse Data and Large-Strata Limiting Models.” Biometrics 42, no. 2 (1986): 311-23.

oddsratio_pooled

The pooled odds ratio.

The value is an estimate of a common odds ratio across all of the stratified tables.

risk_pooled
riskratio_pooled

Estimate of the pooled risk ratio.

Methods

from_data(var1, var2, strata, data)

Construct a StratifiedTable object from data.

logodds_pooled_confint([alpha, method])

A confidence interval for the pooled log odds ratio.

oddsratio_pooled_confint([alpha, method])

A confidence interval for the pooled odds ratio.

summary([alpha, float_format, method])

A summary of all the main results.

test_equal_odds([adjust])

Test that all odds ratios are identical.

test_null_odds([correction])

Test that all tables have odds ratio equal to 1.

Methods

from_data(var1, var2, strata, data)

Construct a StratifiedTable object from data.

logodds_pooled_confint([alpha, method])

A confidence interval for the pooled log odds ratio.

oddsratio_pooled_confint([alpha, method])

A confidence interval for the pooled odds ratio.

summary([alpha, float_format, method])

A summary of all the main results.

test_equal_odds([adjust])

Test that all odds ratios are identical.

test_null_odds([correction])

Test that all tables have odds ratio equal to 1.

Properties

logodds_pooled

Returns the logarithm of the pooled odds ratio.

logodds_pooled_se

Estimated standard error of the pooled log odds ratio

oddsratio_pooled

The pooled odds ratio.

risk_pooled

riskratio_pooled

Estimate of the pooled risk ratio.