This takes the results of multiple comparisons and returns a set of letters that can be used to indicate which differences are significant. The difference between levels that are assigned the same letter are not statistically different.

get_pairwise_letters(tests, alpha_level = 0.05)

Source

Algorithm based on finding maximal cliques of non-significant comparisons.

Arguments

tests

Either a tibble with the result of comparisons, including x and y (the levels/groups that were compared) and p_value for the comparison or an object of class pairwise.htest, for example returned from pairwise.t.test()

alpha_level

The level of significance for the test

Value

A tibble with the group level, a combined letters string, and individual columns for each letter assigned. The tibble is sorted by level.

Examples

# Works with pairwise.htest objects
library(tibble)
library(dplyr)

pwtt <- pairwise.t.test(airquality$Ozone, airquality$Month)
get_pairwise_letters(pwtt)
#> # A tibble: 5 × 5
#>   level letters a     b     c    
#>   <chr> <chr>   <chr> <chr> <chr>
#> 1 5     a       a     NA    NA   
#> 2 6     ab      a     b     NA   
#> 3 7     bc      NA    b     c    
#> 4 8     c       NA    NA    c    
#> 5 9     a       a     NA    NA