| chi_squared_test_pairwise | R Documentation |
Conducts a chi-squared test for every possible pairwise comparison with Bonferroni correction
chi_squared_test_pairwise( data = NULL, iv_name = NULL, dv_name = NULL, focal_dv_value = NULL, contingency_table = TRUE, contingency_table_sigfigs = 2, percent_and_total = FALSE, percentages_only = NULL, counts_only = NULL, sigfigs = 3, chi_sq_test_stats = FALSE, correct = TRUE )
data |
a data object (a data frame or a data.table) |
iv_name |
name of the independent variable (must be a categorical variable) |
dv_name |
name of the dependent variable (must be a binary variable) |
focal_dv_value |
focal value of the dependent variable whose frequencies will be calculated (i.e., the value of the dependent variable that will be considered a "success" or a result of interest) |
contingency_table |
If |
contingency_table_sigfigs |
number of significant digits that the contingency table's percentage values should be rounded to (default = 2) |
percent_and_total |
logical. If |
percentages_only |
tabulate percentages of the focal DV value only |
counts_only |
tabulate counts of the focal DV value only |
sigfigs |
number of significant digits to round to |
chi_sq_test_stats |
if |
correct |
logical. Should continuity correction be applied? (default = TRUE) |
chi_squared_test_pairwise(data = mtcars, iv_name = "vs", dv_name = "am") chi_squared_test_pairwise(data = mtcars, iv_name = "vs", dv_name = "am", percentages_only = TRUE) # using 3 mtcars data sets combined chi_squared_test_pairwise( data = rbind(mtcars, rbind(mtcars, mtcars)), iv_name = "cyl", dv_name = "am") # include the total counts chi_squared_test_pairwise( data = rbind(mtcars, rbind(mtcars, mtcars)), iv_name = "cyl", dv_name = "am", percent_and_total = TRUE) # display counts chi_squared_test_pairwise( data = rbind(mtcars, rbind(mtcars, mtcars)), iv_name = "cyl", dv_name = "am", contingency_table = "counts")