statsmodels.stats.contingency_tables.SquareTable¶
-
class
statsmodels.stats.contingency_tables.SquareTable(table, shift_zeros=True)[source]¶ Methods for analyzing a square contingency table.
Parameters: table : array_like
A square contingency table, or DataFrame that is converted to a square form.
shift_zeros : bool
If True and any cell count is zero, add 0.5 to all values in the table.
These methods should only be used when the rows and columns of the
table have the same categories. If `table` is provided as a
Pandas DataFrame, the row and column indices will be extended to
create a square table, inserting zeros where a row or column is
missing. Otherwise the table should be provided in a square form,
with the (implicit) row and column categories appearing in the
same order.
Methods
from_data(data[, shift_zeros])Construct a Table object from data. homogeneity([method])Compare row and column marginal distributions. summary([alpha, float_format])Produce a summary of the analysis. symmetry([method])Test for symmetry of a joint distribution. test_nominal_association()Assess independence for nominal factors. test_ordinal_association([row_scores, …])Assess independence between two ordinal variables. Methods
from_data(data[, shift_zeros])Construct a Table object from data. homogeneity([method])Compare row and column marginal distributions. summary([alpha, float_format])Produce a summary of the analysis. symmetry([method])Test for symmetry of a joint distribution. test_nominal_association()Assess independence for nominal factors. test_ordinal_association([row_scores, …])Assess independence between two ordinal variables. Properties
chi2_contribsReturns the contributions to the chi^2 statistic for independence. cumulative_log_oddsratiosReturns cumulative log odds ratios. cumulative_oddsratiosReturns the cumulative odds ratios for a contingency table. fittedvaluesReturns fitted cell counts under independence. independence_probabilitiesReturns fitted joint probabilities under independence. local_log_oddsratiosReturns local log odds ratios. local_oddsratiosReturns local odds ratios. marginal_probabilitiesEstimate marginal probability distributions for the rows and columns. resid_pearsonReturns Pearson residuals. standardized_residsReturns standardized residuals under independence.