rstatix
rstatix copied to clipboard
pairwise_chisq_gof_test vs pairwise_prop_test
Hi,
I want to do a post-hoc comparison following a global chi-square test. I have used the pairwise_chisq_gof_test as recommends the help pages but I do not know how the output can be read. For example using the Titanic data the pairwise_chisq_gof_test output split comparisions between group1 and group2 that I think they are survived-yes and survived-no. The problem is when I look at pairwise comparisons becasue I would expect 4 grps (grp1 to grp4) but there are up to grp7 in group1 and grp8 in group2. Manually doing chisq_test(c(528,673)) I can see that this corresponds to comparison of group1-grp6 group2-grp8, but the problem is that I am comparing No_3rd with No-crew.
Data: Titanic
xtab <- as.table(rbind( c(203, 118, 178, 212), c(122, 167, 528, 673) )) dimnames(xtab) <- list( Survived = c("Yes", "No"), Class = c("1st", "2nd", "3rd", "Crew") )
chisq_test(xtab)
A tibble: 1 x 6
n statistic p df method p.signif
-
1 2201 190. 5e-41 3 Chi-square test ****
A tibble: 28 x 8
n group1 group2 statistic p df p.adj p.adj.signif
-
1 2 grp1 grp2 20.2 7.02e- 6 1 9.13e- 5 ****
2 2 grp1 grp3 22.5 2.09e- 6 1 2.93e- 5 ****
3 2 grp1 grp4 3.50 6.13e- 2 1 3.68e- 1 ns
4 2 grp1 grp5 1.64 2 e- 1 1 8 e- 1 ns
5 2 grp1 grp6 144. 2.77e-33 1 4.99e-32 ****
6 2 grp1 grp7 0.195 6.59e- 1 1 1 e+ 0 ns
7 2 grp1 grp8 252. 8.74e-57 1 1.92e-55 ****
8 2 grp2 grp3 0.0667 7.96e- 1 1 1 e+ 0 ns
9 2 grp2 grp4 7.01 8.12e- 3 1 6.5 e- 2 ns
10 2 grp2 grp5 10.5 1.22e- 3 1 1.22e- 2 *