Performs Dunn's (1964) test of multiple comparisons following a significant Kruskal-Wallis test, possibly with a correction to control the experimentwise error rate. This is largely a wrapper for the `dunn.test`

function in dunn.test. Please see and cite that package.

`dunnTest(x, ...)`# S3 method for default
dunnTest(x, g, method = dunn.test::p.adjustment.methods[c(4,
2:3, 5:8, 1)], two.sided = TRUE, altp = two.sided, ...)

# S3 method for formula
dunnTest(x, data = NULL,
method = dunn.test::p.adjustment.methods[c(4, 2:3, 5:8, 1)],
two.sided = TRUE, altp = two.sided, ...)

# S3 method for dunnTest
print(x, dunn.test.results = FALSE, ...)

x

A numeric vector of data values or a formula of the form x~g.

…

Not yet used.

g

A factor vector or a (non-numeric) vector that can be coerced to a factor vector.

method

A single string that identifies the method used to control the experimentwise error rate. See the list of methods in `p.adjustment.methods`

in dunn.test.

two.sided

A single logical that indicates whether a two-sided p-value should be returned (`TRUE`

; default) or not. See details.

altp

Same as `two.sided`

. Allows similar code with the `dunn.test`

function in dunn.test. `two.sided`

is maintained because it pre-dates `altp`

.

data

A data.frame that minimally contains `x`

and `g`

.

dunn.test.results

A single logical that indicates whether the results that would have been printed by `dunn.test`

function in dunn.test are shown.

A list with three items -- `method`

is the long name of the method used to control the experimentwise error rate, `dtres`

is the strings that would have been printed by the `dunn.test`

function in dunn.test, and `res`

is a data.frame with the following variables:

Comparison: Labels for each pairwise comparison.

Z: Values for the Z test statistic for each comparison.

P.unadj: Unadjusted p-values for each comparison.

P.adj: Adjusted p-values for each comparison.

This function performs “Dunn's” test of multiple comparisons following a Kruskal-Wallis test. Unadjusted one- or two-sided p-values for each pairwise comparison among groups are computed following Dunn's description as implemented in the `dunn.test`

function from dunn.test. These p-values may be adjusted using methods in the `p.adjustment.methods`

function in dunn.test.

This function is largely a wrapper for the `dunn.test`

function in dunn.test. Changes here are the possible use of formula notation, results not printed by the main function (but are printed in a more useful format (in my opinion) by the `print`

function), the p-values are adjusted by default with the “holm” method, and two-sided p-values are returned by default. See `dunn.test`

function in dunn.test for a more details underlying these computations.

Dunn, O.J. 1964. Multiple comparisons using rank sums. Technometrics 6:241-252.

See `kruskal.test`

, `dunn.test`

in dunn.test, `posthoc.kruskal.nemenyi.test`

in PMCMR, `kruskalmc`

in pgirmess, and `kruskal`

in agricolae.

# NOT RUN { ## pH in four ponds data from Zar (2010) ponds <- data.frame(pond=as.factor(rep(1:4,each=8)), pH=c(7.68,7.69,7.70,7.70,7.72,7.73,7.73,7.76, 7.71,7.73,7.74,7.74,7.78,7.78,7.80,7.81, 7.74,7.75,7.77,7.78,7.80,7.81,7.84,NA, 7.71,7.71,7.74,7.79,7.81,7.85,7.87,7.91)) ponds2 <- ponds[complete.cases(ponds),] # non-formula usage (default "holm" method) dunnTest(ponds2$pH,ponds2$pond) # formula usage (default "holm" method) dunnTest(pH~pond,data=ponds2) # other methods dunnTest(pH~pond,data=ponds2,method="bonferroni") dunnTest(pH~pond,data=ponds2,method="bh") dunnTest(pH~pond,data=ponds2,method="none") # one-sided dunnTest(pH~pond,data=ponds2,two.sided=FALSE) # warning message if incomplete cases were removed dunnTest(pH~pond,data=ponds) # print dunn.test results tmp <- dunnTest(pH~pond,data=ponds2) print(tmp,dunn.test.results=TRUE) # }

Run the code above in your browser using DataCamp Workspace