Compute and return information on tests for group differences in the data.
Usage
group_tests(
data,
tests = c("tukey", "snk", "lsd", "bt", "kramer", "duncan", "scheffe", "tamhaneT2",
"uwh", "gh", "d3", "dunn", "dscf", "kwc", "kwd", "kwn", "median"),
alpha = 0.05
)Arguments
- data
Data.frame with the first column the values and the second column the group names
- tests
Vector of strings, or a string, indicating the tests to check. Options include 'tukey','snk','lsd','bt','kramer', 'duncan', 'scheffe', 'tamhaneT2', 'uwh', 'gh', 'd3', 'dunn', 'dscf', 'kwc', 'kwd', 'kwn', and 'median'
- alpha
Significance for confidence intervals / signficance of some tests, defaults to 0.05
Details
Tests require independent data unless otherwise specified.
Normally distributed data with equal variances and reasonably similarly sized groups. tukey: Tukey honest significant differences snk: Student-Newman-Keuls test lsd: Least significant difference test bt: Bonferroni corrected pairwist t-tests (for pooled and unpooled variances)
The following typically permit inbalance in the data group sizes. kramer: Tukey-Kramer test duncan: Duncan's all-pairs comparisons scheffe: Scheffe's test
The following typically permit more inbalance in data sizes and unequal variances tamhaneT2: Tamhane's T2 all-pairs comparison test uwh: Ury-Wiggins and Hochberg's all-pairs comparison test
The following typically permit inbalance in data sizes, unequal variances, and some non-normality gh: Games-Howell test d3: Dunnett's T3 test
The following are non-parametric dunn: Dunn's test of multiple comparisions using rank sums dscf: Dwass, Steel, Critchlow and Fligner all-pairs comparision test kwc: Kruskal-Wallis type, Conover's non-parametric all-pairs comparison test kwd: Kruskal-Wallis type, Dunn's non-parametric all-pairs comparison test kwn: Kruskal-Wallis type, Nemeyi's non-parametric all-pairs comparison test median: Brown-Mood all paris median test
References to specific functions are given in the seealso section
See also
two_group_tests(), stats::TukeyHSD(), PMCMRplus::snkTest(),
PMCMRplus::lsdTest(), stats::pairwise.t.test(), agricolae::HSD.test(),
PMCMRplus::duncanTest(), PMCMRplus::scheffeTest(),
PMCMRplus::tamhaneT2Test(), PMCMRplus::uryWigginsHochbergTest(),
games_howell(), PMCMRplus::dunnettT3Test(), dunn.test::dunn.test(),
PMCMRplus::dscfAllPairsTest(), PMCMRplus::kwAllPairsConoverTest(),
PMCMRplus::kwAllPairsDunnTest(), PMCMRplus::kwAllPairsNemenyiTest(),
PMCMRplus::medianAllPairsTest()
Examples
data <- data.frame(
"value" = c(rnorm(14, sd = 2), rnorm(6), rnorm(20, mean = 2)),
"group" = c(rep("A", 14), rep("B", 6), rep("C", 20))
)
group_tests(data)
#> $means
#> A B C
#> 0.29318686 0.01360482 2.08485258
#>
#> $medians
#> A B C
#> 0.8376081 -0.1615766 2.2312901
#>
#> $tukey
#> $tukey$details
#> diff lwr upr p adj
#> B-A -0.279582 -1.7423711 1.183207 0.8872680806
#> C-A 1.791666 0.7470254 2.836306 0.0004812018
#> C-B 2.071248 0.6758359 3.466660 0.0024417340
#>
#> $tukey$groups
#> A B C
#> "a" "a" "b"
#>
#>
#> $snk
#> $snk$pvalues
#> A B
#> B 0.6434937809 NA
#> C 0.0001673345 0.002441734
#>
#> $snk$groups
#> mean sd n Sig. group
#> A 0.293 1.770 14 a
#> B 0.014 1.026 6 a
#> C 2.085 0.719 20 b
#>
#>
#> $lsd
#> $lsd$pvalues
#> A B
#> B 0.6434937809 NA
#> C 0.0001673345 0.0008668911
#>
#> $lsd$groups
#> mean sd n Sig. group
#> A 0.293 1.770 14 a
#> B 0.014 1.026 6 a
#> C 2.085 0.719 20 b
#>
#>
#> $bt
#> $bt$pvalues
#> A B
#> B 1.0000000000 NA
#> C 0.0005020035 0.002600673
#>
#> $bt$pvalues_nonpool
#> NULL
#>
#>
#> $tukey_kramer
#> value groups
#> C 2.08485258 a
#> A 0.29318686 b
#> B 0.01360482 b
#>
#> $duncan
#> $duncan$pvalues
#> A B
#> B 0.606465700 NA
#> C 0.001978661 0.0006448987
#>
#> $duncan$groups
#> mean sd n Sig. group
#> A 0.293 1.770 14 a
#> B 0.014 1.026 6 a
#> C 2.085 0.719 20 b
#>
#>
#> $scheffe
#> $scheffe$pvalues
#> A B
#> B 0.8971276186 NA
#> C 0.0007644358 0.00362599
#>
#> $scheffe$groups
#> mean sd n Sig. group
#> A 0.293 1.770 14 a
#> B 0.014 1.026 6 a
#> C 2.085 0.719 20 b
#>
#>
#> $uwh
#> $uwh$pvalues
#> A B
#> B 0.66403527 NA
#> C 0.00738035 0.00738035
#>
#> $uwh$groups
#> mean sd n Sig. group
#> A 0.293 1.770 14 a
#> B 0.014 1.026 6 a
#> C 2.085 0.719 20 b
#>
#>
#> $games_howell
#> diff lwr upr se t df p
#> B-A -0.279582 -1.9104500 1.351286 0.4467041 0.4425622 15.922903 0.898337534
#> C-A 1.791666 0.5030378 3.080294 0.3531952 3.5869651 16.028935 0.006565225
#> C-B 2.071248 0.7273445 3.415151 0.3172090 4.6171239 6.543164 0.007033230
#>
#> $dunnett_t3
#> $dunnett_t3$pvalues
#> A B
#> B 0.958868758 NA
#> C 0.007315785 0.006662155
#>
#> $dunnett_t3$groups
#> mean sd n Sig. group
#> A 0.293 1.770 14 a
#> B 0.014 1.026 6 a
#> C 2.085 0.719 20 b
#>
#>
#> $dunn
#> comparisons adj.p
#> 1 A - B 0.2078470313
#> 2 A - C 0.0002671351
#> 3 B - C 0.0002848208
#>
#> $dscf
#> $dscf$pvalues
#> A B
#> B 0.63569677 NA
#> C 0.00135517 0.002353587
#>
#> $dscf$groups
#> mean sd n Sig. group
#> A 0.293 1.770 14 a
#> B 0.014 1.026 6 a
#> C 2.085 0.719 20 b
#>
#>
#> $kw_conover
#> $kw_conover$pvalues
#> A B
#> B 0.5282258595 NA
#> C 0.0001304207 0.0001398664
#>
#> $kw_conover$groups
#> mean sd n Sig. group
#> A 0.293 1.770 14 a
#> B 0.014 1.026 6 a
#> C 2.085 0.719 20 b
#>
#>
#> $kw_dunn
#> $kw_dunn$pvalues
#> A B
#> B 0.415694063 NA
#> C 0.001602811 0.001602811
#>
#> $kw_dunn$groups
#> mean sd n Sig. group
#> A 0.293 1.770 14 a
#> B 0.014 1.026 6 a
#> C 2.085 0.719 20 b
#>
#>
#> $kw_nemenyi
#> $kw_nemenyi$pvalues
#> A B
#> B 0.694388086 NA
#> C 0.001549346 0.001650566
#>
#> $kw_nemenyi$groups
#> mean sd n Sig. group
#> A 0.293 1.770 14 a
#> B 0.014 1.026 6 a
#> C 2.085 0.719 20 b
#>
#>
#> $median
#> $median$pvalues
#> A B
#> B 0.6562260300 NA
#> C 0.0006296354 0.0003715122
#>
#> $median$groups
#> mean sd n Sig. group
#> A 0.293 1.770 14 a
#> B 0.014 1.026 6 a
#> C 2.085 0.719 20 b
#>
#>