make_cld: Make a compact letter display (cld) for pair-wise comparison

Description Usage Arguments Value Examples

View source: R/make_cld.R

Description

Make a compact letter display for results of pair-wise comparisons (e.g., ANOVA post-hoc tests, Kruskal-Wallis post-hoc tests and other).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
make_cld(obj, ..., alpha = 0.05)

## S3 method for class 'pairwise.htest'
make_cld(obj, ..., alpha = 0.05)

## S3 method for class 'posthocTGH'
make_cld(obj, ..., alpha = obj$intermediate$alpha)

## S3 method for class 'posthoc_anova'
make_cld(obj, ..., alpha = 1 - obj$input$conf_level)

## S3 method for class 'PMCMR'
make_cld(obj, ..., alpha = 0.05)

## S3 method for class 'formula'
make_cld(obj, ..., data = NULL, alpha = 0.05)

## S3 method for class 'matrix'
make_cld(obj, ..., alpha = 0.05)

## S3 method for class 'data.frame'
make_cld(obj, ..., formula = p.adjust ~ Comparison, alpha = 0.05)

## S3 method for class 'pairwise_pval_df'
make_cld(obj, ..., alpha = 0.05)

Arguments

obj

Object with pair-wise comparisons (e.g., post-hoc test results). Currently supported objects:

  • posthocTGH from package userfriendlyscience;

  • PMCMR from package PMCMR.

...

Further arguments to methods.

alpha

(numeric from 0 to 1) Significance level.

data

A dataset with p values and names of comparisons. This argument is used if obj is formula. More details in examples.

formula

An R model stats::formula() where left-hand side term indicates variable with p values and right-hand side term defines variable with comparisons, e.g. p.adjust ~ Comparison. Usually is used in combination with data.

Value

(A data frame with) compact letter display.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
library(biostat)

# Example 1: class `pairwise.htest`

obj1 <- pairwise.wilcox.test(chickwts$weight, chickwts$feed, exact = FALSE)
make_cld(obj1)


# Example 2: class `pairwise.htest`

obj2 <- with(OrchardSprays, pairwise.t.test(decrease, treatment))
make_cld(obj2)


# Example 3: class `pairwise.htest`

smokers <- c(83, 90, 129, 70)
patients <- c(86, 93, 136, 82)
obj3 <- pairwise.prop.test(smokers, patients)

make_cld(obj3)


# Example 4: class `PMCMR`

obj4 <- PMCMR::posthoc.kruskal.conover.test(count ~ spray, data = InsectSprays)
make_cld(obj4)



# Example 5: class `posthocTGH`

obj5 <- posthoc_anova(weight ~ Diet,
  data = ChickWeight,
  method = "Games-Howell"
)
make_cld(obj5)


# Example 6: class `posthoc_anova`

obj6 <- posthoc_anova(weight ~ Diet,
  data = ChickWeight,
  method = "Games-Howell"
)
make_cld(obj6)


# Example 7: class `formula`

my_dataframe <- data.table::fread(
  'Comparison     p.value p.adjust
    "EE - GB = 0"        1 1.000000
    "EE - CY = 0" 0.001093 0.003279
    "GB - CY = 0" 0.005477 0.008216'
)

make_cld(p.adjust ~ Comparison, data = my_dataframe)


# Example 8: class `matrix`

# (for symetric matrices of p values)

# Create matrix
m <- c(
  1.00, 0.22, 0.05, 0.00,
  0.22, 1.00, 0.17, 0.01,
  0.05, 0.17, 1.00, 0.22,
  0.00, 0.01, 0.22, 1.00
)
obj8 <- matrix(m, nrow = 4)
rownames(obj8) <- colnames(obj8) <- c("P", "O", "I", "U")
obj8

# Make cld
make_cld(obj8)

GegznaV/BioStat documentation built on Aug. 14, 2020, 9:30 p.m.