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(x, dv, grp, distribution = "asymptotic", weight.by = NULL,
  out = c("txt", "viewer", "browser"))

Arguments

x

A (grouped) data frame.

dv

Name of the dependent variable, for which the mean value, grouped by grp, is computed.

grp

Factor with the cross-classifying variable, where dv is grouped into the categories represented by grp. Numeric vectors are coerced to factors.

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.

weight.by

Name of variable in x that indicated the vector of weights that will be applied to weight all observations. Default is NULL, so no weights are used.

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 = 41905.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 = 68265.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 = 65703.000, 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 = 139656.000, 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 = 135981.000, 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 = 180901.000, 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