pairwiseOrdinalIndependence function

Pairwise tests of independence for tables with one ordered nominal variable

Pairwise tests of independence for tables with one ordered nominal variable

Conducts pairwise tests for a 2-dimensional table, in which one variable is ordered nominal and one variable is non-ordered nominal. The function relies on the coin package.

pairwiseOrdinalIndependence( x, compare = "row", scores = NULL, method = "fdr", digits = 3, ... )

Arguments

  • x: A two-way contingency table. One dimension is ordered and one is non-ordered nominal.
  • compare: If "row", treats the rows as the grouping variable. If "column", treats the columns as the grouping variable.
  • scores: Optional vector to specify the spacing of the ordered variable.
  • method: The method to adjust multiple p-values. See stats::p.adjust.
  • digits: The number of significant digits in the output.
  • ...: Additional arguments, passed to stats::chisq_test.

Returns

A data frame of comparisons, p-values, and adjusted p-values.

Examples

### Independence test for table with one ordered variable data(Breakfast) require(coin) chisq_test(Breakfast, scores = list("Breakfast" = c(-2, -1, 0, 1, 2))) PT = pairwiseOrdinalIndependence(Breakfast, compare = "row") PT cldList(comparison = PT$Comparison, p.value = PT$p.value, threshold = 0.05) ### Similar to Kruskal-Wallis test for Likert data data(PoohPiglet) XT = xtabs(~ Speaker + Likert, data = PoohPiglet) XT require(coin) chisq_test(XT, scores = list("Likert" = c(1, 2, 3, 4, 5))) PT=pairwiseOrdinalIndependence(XT, compare = "row") PT cldList(comparison = PT$Comparison, p.value = PT$p.value, threshold = 0.05)

References

https://rcompanion.org/handbook/H_09.html

See Also

pairwiseNominalIndependence

Author(s)

Salvatore Mangiafico, mangiafico@njaes.rutgers.edu