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, p.adjust.method = "none")

Source

Algorithm based on https://www.tandfonline.com/doi/abs/10.1198/1061860043515

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

p.adjust.method

One of p.adjust.methods, defaults to none as p-values will typically have been adjusted when carrying out the pairwise comparisons/post-hoc tests

Value

A tibble with columns that indicate which letter has been assigned to each group/level

Examples

data("airquality")
airquality$month <- factor(airquality$Month, labels = month.abb[5:9])
x <- pairwise.t.test(airquality$Ozone, airquality$Month)

get_pairwise_letters(x)
#> # 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