This function performs a Mann-Whitney-U-Test (or Wilcoxon rank sum test, see wilcox.test and wilcox_test) for x, for each group indicated by grp. If grp has more than two categories, a comparison between each combination of two groups is performed.

The function reports U, p and Z-values as well as effect size r and group-rank-means.

mwu(data, x, grp, distribution = "asymptotic", out = c("txt", "viewer",
  "browser"))

Arguments

data

A data frame.

x

Bare (unquoted) variable name, or a character vector with the variable name.

grp

Bare (unquoted) name of the cross-classifying variable, where x is grouped into the categories represented by grp, or a character vector with the variable name.

distribution

Indicates how the null distribution of the test statistic should be computed. May be one of "exact", "approximate" or "asymptotic" (default). See wilcox_test for details.

out

Character vector, indicating whether the results should be printed to console (out = "txt") or as HTML-table in the viewer-pane (out = "viewer") or browser (out = "browser"), of if the results should be plotted (out = "plot", only applies to certain functions). May be abbreviated.

Value

(Invisibly) returns a data frame with U, p and Z-values for each group-comparison as well as effect-size r; additionally, group-labels and groups' n's are also included.

Note

This function calls the wilcox_test with formula. If grp has more than two groups, additionally a Kruskal-Wallis-Test (see kruskal.test) is performed.

Interpretation of effect sizes, as a rule-of-thumb:

  • small effect >= 0.1

  • medium effect >= 0.3

  • large effect >= 0.5

Examples

data(efc) # Mann-Whitney-U-Tests for elder's age by elder's dependency. mwu(efc, e17age, e42dep)
#> #> # Mann-Whitney-U-Test #> #> Groups 1 = independent (n = 65) | 2 = slightly dependent (n = 224): #> U = 7635.000, W = 5490.000, p = 0.003, Z = -3.020 #> effect-size r = 0.100 #> rank-mean(1) = 117.46 #> rank-mean(2) = 152.99 #> #> Groups 1 = independent (n = 65) | 3 = moderately dependent (n = 304): #> U = 8692.000, W = 6547.000, p < 0.001, Z = -4.273 #> effect-size r = 0.142 #> rank-mean(1) = 133.72 #> rank-mean(3) = 195.96 #> #> Groups 1 = independent (n = 65) | 4 = severely dependent (n = 297): #> U = 7905.500, W = 5760.500, p < 0.001, Z = -5.096 #> effect-size r = 0.169 #> rank-mean(1) = 121.62 #> rank-mean(4) = 194.60 #> #> Groups 2 = slightly dependent (n = 224) | 3 = moderately dependent (n = 304): #> U = 54664.500, W = 29464.500, p = 0.008, Z = -2.647 #> effect-size r = 0.088 #> rank-mean(2) = 244.04 #> rank-mean(3) = 279.58 #> #> Groups 2 = slightly dependent (n = 224) | 4 = severely dependent (n = 297): #> U = 51007.500, W = 25807.500, p < 0.001, Z = -4.386 #> effect-size r = 0.146 #> rank-mean(2) = 227.71 #> rank-mean(4) = 286.11 #> #> Groups 3 = moderately dependent (n = 304) | 4 = severely dependent (n = 297): #> U = 87819.500, W = 41459.500, p = 0.083, Z = -1.732 #> effect-size r = 0.057 #> rank-mean(3) = 288.88 #> rank-mean(4) = 313.41 #> #> # Kruskal-Wallis-Test #> #> chi-squared = 38.476 #> df = 3 #> p < 0.001