# Post hoc test for chi square test

Hello. I have questions regarding post hoc test following chi square test of independence. I know that many websites explained it, but it seems that each website explains some aspects and no website explains all the aspects or shows the whole picture. My questions are the following:

1- What is the main idea of post hoc test? For example, if I have a certain disease in the rows with 3 categories (mild, moderate, severe) and complications of this disease in the columns with 2 categories (yes, no) so it is a 3 by 2 contingency table, and I do a chi square test and get a significant p value then I do a post hoc test, does the post hoc test mean dealing with each row alone? I mean does the post hoc test mean that we will deal with the 3 by 2 table as 3 individual rows and deal with each individual row in a way similar to goodness of fit test? So, the post hoc test will take the first row (mild disease with 2 columns for complications: yes/ no) and calculate the p value for it, then take the second row (moderate disease with 2 columns: yes/ no) and calculate the p value for it, then finally take the third row (severe disease with 2 columns: yes/ no) and calculate the p value for it, is this the idea or the way in which post hoc test is done (whether done manually or by software like excel or spss) or I understood it wrong? If I was wrong then what is the correct idea?

2- How to do the Bonferroni correction or calculate the number of pairwise comparisons? Many websites say it is calculated by multiplying number of rows by columns, so, in the above example it must be 3 by 2 which equals 6, however, I saw many examples online in which the number of pairwise comparisons for 3 by 2 table is 3 not 6 where they explain it in this way: we will compare the first row with the second row, and the first with the third and the second with the third, so we have 3 comparisons not 6.
And what If I have the same example above but with 3 categories in both rows and columns i.e., 3 by 3 table where the rows are disease (mild, moderate, severe) and columns are complications (no, some complications, all complications), so, in this scenario the number of pairwise comparisons should be 9 (multiplying 3 by 3) or it should be 3 (comparing the first row with the second and first with the third and the second with the third)?

3- What is the step-by-step procedure of doing post hoc test in Excel? I saw some examples but I didn’t understand how to interpret the so called “p values of adjusted residuals” where there was a 3 by 3 table i.e., 9 cells and each cell contains p value in it, i.e., 9 p values. What does each p value in each cell mean or refer to?

i think it would help you if you write out the hypotheses and not think of it in rows etc. This is a recent open access paper covering the topic: 3 groups All pairwise comparisons may not necessarily be of interest but there would be k(k-1)/2 comparisons

Thanks , I will check the paper and see.