pairwisePermutationTest {rcompanion}R Documentation

Pairwise two-sample independence tests

Description

Conducts pairwise two-sample independence tests across groups.

Usage

pairwisePermutationTest(
  formula = NULL,
  data = NULL,
  x = NULL,
  g = NULL,
  method = "fdr",
  ...
)

Arguments

formula

A formula indicating the measurement variable and the grouping variable. e.g. y ~ group.

data

The data frame to use.

x

The response variable as a vector.

g

The grouping variable as a vector.

method

The p-value adjustment method to use for multiple tests. See stats::p.adjust.

...

Additional arguments passed to coin::independence_test.

Details

The input should include either formula and data; or x, and g.

This function is a wrapper for coin::independence_test, passing pairwise groups to the function. It's critical to read and understand the documentation for this function to understand its use and options.

For some options for common tests, see Horthorn et al., 2008.

Value

A dataframe of the groups being compared, the p-values, and the adjusted p-values.

Note

The parsing of the formula is simplistic. The first variable on the left side is used as the measurement variable. The first variable on the right side is used for the grouping variable.

Author(s)

Salvatore Mangiafico, mangiafico@njaes.rutgers.edu

References

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

Hothorn, T., K. Hornik, M.A. van de Wiel, and A. Zeileis. 2008. Implementing a Class of Permutation Tests: The coin Package. Journal of Statistical Software, 28(8), 1–23.

See Also

pairwisePermutationMatrix

Examples

### Fisher-Pitman test

data(BrendonSmall)

library(coin)
                     
independence_test(Sodium ~ Instructor, data = BrendonSmall, 
                 teststat="quadratic")
                                       
PT = pairwisePermutationTest(Sodium ~ Instructor,
                             data   = BrendonSmall,
                             teststat="quadratic",
                             method = "fdr")
PT

cldList(comparison = PT$Comparison,
        p.value    = PT$p.adjust,
        threshold  = 0.05)


[Package rcompanion version 2.4.36 Index]