pairwise.chisq.test | R Documentation |
This function performs pairwise Chi-Square tests for two factors.
pairwise.chisq.test(A, B, p.adjust.method = "bonferroni")
A |
A factor with two or moew levels. The first variable. |
B |
A factor with two or more levels. The second variable. |
p.adjust.method |
A string specifying the method for adjusting p-values. Default is "bonferroni". |
This function creates all possible pairs of levels of factor B and performs a Chi-Square test for each pair of B on variable A. The p-values are adjusted according to the specified method.
#' This function is created for educational purposes only. For exact p-values, consider using reporttools::pairwise.fisher.test()
.
A data frame with the results of the pairwise Chi-Square tests. Includes the groups, Chi-Square statistic, degrees of freedom, p-values, adjusted p-values, and significance stars.
set.seed(123)
A <- factor(sample(c("Male", "Female"), 100, replace = TRUE))
B <- factor(sample(c("Location1", "Location2", "Location3"), 100, replace = TRUE))
pairwise.chisq.test(A, B, "holm")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.