knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(chisq.posthoc.test)
When computing Pearson's Chi-squared Test for Count Data the only result you get is that you know that there is a significant difference in the data and not which parts of the data are responsible for this. Here you see the example from the chisq.test documentation.
M <- as.table(rbind(c(762, 327, 468), c(484, 239, 477))) dimnames(M) <- list(gender = c("F", "M"), party = c("Democrat","Independent", "Republican")) chisq.test(M)
As a form of post hoc analysis the standarized residuals can be analysed. A rule of thumb is that standarized residuals of above two show significance.
chisq.results <- chisq.test(M) chisq.results$stdres
However, the above two rule is a rule of thumb. These standarized residuals can be used to calculate p-values, which is what this package is designed for as shown in the following example.
chisq.posthoc.test(M, method = "bonferroni")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.