Make a compact letter display for results of pair-wise comparisons (e.g., ANOVA post-hoc tests, Kruskal-Wallis post-hoc tests and other).
make_cld(obj, ..., alpha = 0.05) # S3 method for pairwise.htest make_cld(obj, ..., alpha = 0.05) # S3 method for posthocTGH make_cld(obj, ..., alpha = obj$intermediate$alpha) # S3 method for posthoc_anova make_cld(obj, ..., alpha = 1 - obj$input$conf_level) # S3 method for PMCMR make_cld(obj, ..., alpha = 0.05) # S3 method for formula make_cld(obj, ..., data = NULL, alpha = 0.05) # S3 method for matrix make_cld(obj, ..., alpha = 0.05) # S3 method for data.frame make_cld(obj, ..., formula = p.adjust ~ Comparison, alpha = 0.05) # S3 method for pairwise_pval_df make_cld(obj, ..., alpha = 0.05)
obj | Object with pair-wise comparisons (e.g., post-hoc test results). Currently supported objects:
|
---|---|
... | 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 |
formula | An R model |
(A data frame with) compact letter display.
library(biostat) # Example 1: class `pairwise.htest` obj1 <- pairwise.wilcox.test(chickwts$weight, chickwts$feed, exact = FALSE) make_cld(obj1)#> group cld spaced_cld #> 1 casein a a__ #> 2 horsebean b _b_ #> 3 linseed bc _bc #> 4 meatmeal ac a_c #> 5 soybean c __c #> 6 sunflower a a__# Example 2: class `pairwise.htest` obj2 <- with(OrchardSprays, pairwise.t.test(decrease, treatment)) make_cld(obj2)#> group cld spaced_cld #> 1 A a a__ #> 2 B a a__ #> 3 C a a__ #> 4 D ab ab_ #> 5 E bc _bc #> 6 F c __c #> 7 G c __c #> 8 H c __c# Example 3: class `pairwise.htest` # \donttest{ smokers <- c(83, 90, 129, 70) patients <- c(86, 93, 136, 82) obj3 <- pairwise.prop.test(smokers, patients)#> Warning: Chi-squared approximation may be incorrect#> Warning: Chi-squared approximation may be incorrect#> Warning: Chi-squared approximation may be incorrectmake_cld(obj3)#> group cld spaced_cld #> 1 1 a a #> 2 2 a a #> 3 3 a a #> 4 4 a a# } # Example 4: class `PMCMR` # \donttest{ obj4 <- PMCMR::posthoc.kruskal.conover.test(count ~ spray, data = InsectSprays)#> Warning: Ties are present. Quantiles were corrected for ties.make_cld(obj4)#> group cld spaced_cld #> 1 A a a__ #> 2 B a a__ #> 3 C b _b_ #> 4 D c __c #> 5 E bc _bc #> 6 F a a__# } # Example 5: class `posthocTGH` obj5 <- posthoc_anova(weight ~ Diet, data = ChickWeight, method = "Games-Howell" ) make_cld(obj5)#> group cld spaced_cld #> 1 1 a a_ #> 2 2 b _b #> 3 3 b _b #> 4 4 b _b# Example 6: class `posthoc_anova` obj6 <- posthoc_anova(weight ~ Diet, data = ChickWeight, method = "Games-Howell" ) make_cld(obj6)#> group cld spaced_cld #> 1 1 a a_ #> 2 2 b _b #> 3 3 b _b #> 4 4 b _b# 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)#> group cld spaced_cld #> 1 EE a a_ #> 2 GB a a_ #> 3 GB0 ab ab #> 4 CY0 b _b# 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#> P O I U #> P 1.00 0.22 0.05 0.00 #> O 0.22 1.00 0.17 0.01 #> I 0.05 0.17 1.00 0.22 #> U 0.00 0.01 0.22 1.00# Make cld make_cld(obj8)#> group cld spaced_cld #> 1 P a a_ #> 2 O a a_ #> 3 I ab ab #> 4 U b _b