-
Notifications
You must be signed in to change notification settings - Fork 51
/
dunn_test.Rd
74 lines (68 loc) · 3.18 KB
/
dunn_test.Rd
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dunn_test.R
\name{dunn_test}
\alias{dunn_test}
\title{Dunn's Test of Multiple Comparisons}
\usage{
dunn_test(data, formula, p.adjust.method = "holm", detailed = FALSE)
}
\arguments{
\item{data}{a data.frame containing the variables in the formula.}
\item{formula}{a formula of the form \code{x ~ group} where \code{x} is a
numeric variable giving the data values and \code{group} is a factor with
one or multiple levels giving the corresponding groups. For example,
\code{formula = TP53 ~ cancer_group}.}
\item{p.adjust.method}{method to adjust p values for multiple comparisons.
Used when pairwise comparisons are performed. Allowed values include "holm",
"hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none". If you don't
want to adjust the p value (not recommended), use p.adjust.method = "none".}
\item{detailed}{logical value. Default is FALSE. If TRUE, a detailed result is
shown.}
}
\value{
return a data frame with some of the following columns: \itemize{
\item \code{.y.}: the y (outcome) variable used in the test. \item
\code{group1,group2}: the compared groups in the pairwise tests. \item
\code{n1,n2}: Sample counts. \item \code{estimate}: mean ranks difference.
\item \code{estimate1, estimate2}: show the mean rank values of the two
groups, respectively. \item \code{statistic}: Test statistic (z-value) used
to compute the p-value. \item \code{p}: p-value. \item \code{p.adj}: the
adjusted p-value. \item \code{method}: the statistical test used to compare
groups. \item \code{p.signif, p.adj.signif}: the significance level of
p-values and adjusted p-values, respectively. }
The \strong{returned object has an attribute called args}, which is a list
holding the test arguments.
}
\description{
Performs Dunn's test for pairwise multiple comparisons of the
ranked data. The mean rank of the different groups is compared. Used for
post-hoc test following Kruskal-Wallis test.
The default of the \code{rstatix::dunn_test()} function is to perform a
two-sided Dunn test like the well known commercial softwares, such as SPSS
and GraphPad. This is not the case for some other R packages
(\code{dunn.test} and \code{jamovi}), where the default is to perform
one-sided test. This discrepancy is documented at
\href{https://github.com/kassambara/rstatix/issues/50}{https://github.com/kassambara/rstatix/issues/50}.
}
\details{
DunnTest performs the post hoc pairwise multiple comparisons
procedure appropriate to follow up a Kruskal-Wallis test, which is a
non-parametric analog of the one-way ANOVA. The Wilcoxon rank sum test,
itself a non-parametric analog of the unpaired t-test, is possibly
intuitive, but inappropriate as a post hoc pairwise test, because (1) it
fails to retain the dependent ranking that produced the Kruskal-Wallis test
statistic, and (2) it does not incorporate the pooled variance estimate
implied by the null hypothesis of the Kruskal-Wallis test.
}
\examples{
# Simple test
ToothGrowth \%>\% dunn_test(len ~ dose)
# Grouped data
ToothGrowth \%>\%
group_by(supp) \%>\%
dunn_test(len ~ dose)
}
\references{
Dunn, O. J. (1964) Multiple comparisons using rank sums
Technometrics, 6(3):241-252.
}