# Correction for multiple comparisons for Chi-Square Test of Association?

Mock data:

df = pd.DataFrame({
'Treatment': [1, 2, 3],
'Success': [25, 29, 25],
'Fail': [48, 118, 92]
})

Where 'Treatment' represents three independent groups of subjects who received one of three treatments, 'Success' the number of people who were cured by the treatment, and 'Fail' the number of subjects who were not cured by the treatment.

We store the results in the following 3x2 array:

results = np.array([[25, 48], [29, 118], [25, 92]])

And we finally run a Chi-square test for independence to test whether there is an association between treatment type (1, 2, or 3) and outcome of treatment (success or fail):

chi_square, p_value, df, matrix = stats.chi2_contingency(observed=results)
print(chi_square)
print(p_value)
print(df)
print(matrix)

Out:

6.158896567124848
0.0459846201224755
2
[[ 17.11275964  55.88724036]
[ 34.45994065 112.54005935]
[ 27.4272997   89.5727003 ]]

I have two questions:

1. Since we are comparing three (not two) groups/treatments, do we need to apply a correction for multiple comparisons? E.g. Bonferroni's, Šidák's, etc., and if not, why? Note that p-value is just under .05
2. What Python function can we use to see which of the comparisons were significant, i.e. not just the overall result? Or, can we print the Chi-square statistic and p-value for each of the three comparisons? And this, without running three separate comparisons.

Many thanks!

You did one chi-squared test, albeit with $$3-1=2$$ degrees of freedom, so the answer to your Q1 is no, no further adjustment is needed for multiple testing as the degrees of freedom have already been taken into account. There was one chi-squared statistic and one $$p$$-value from this test.