mwu {sjstats}R Documentation

Mann-Whitney-U-Test

Description

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.

Usage

mwu(x, grp, distribution = "asymptotic", weight.by = NULL, out = c("txt",
  "viewer", "browser"))

Arguments

x

Numeric vector or variable.

grp

Grouping variable indicating the groups that should be used for comparison.

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

Vector of weights that will be applied to weight all observations. Must be a vector of same length as the input vector. 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").

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:

Examples

data(efc)
# Mann-Whitney-U-Tests for elder's age by elder's dependency.
mwu(efc$e17age, efc$e42dep)


[Package sjstats version 0.14.2-3 Index]