Making text subtitle for the Mann-Whitney U-test (between-subjects designs).

Making text subtitle for the Mann-Whitney U-test (between-subjects designs).

subtitle_mann_nonparametric(data, x, y, paired = FALSE, k = 2,
  conf.level = 0.95, conf.type = "norm", nboot = 100,
  stat.title = NULL, messages = TRUE, ...)

subtitle_t_nonparametric(data, x, y, paired = FALSE, k = 2, conf.level = 0.95, conf.type = "norm", nboot = 100, stat.title = NULL, messages = TRUE, ...)


A dataframe (or a tibble) from which variables specified are to be taken. A matrix or tables will not be accepted.


The grouping variable from the dataframe data.


The response (a.k.a. outcome or dependent) variable from the dataframe data.


Logical that decides whether the design is repeated measures/within-subjects (in which case one-way Friedman Rank Sum Test will be carried out) or between-subjects (in which case one-way Kruskal<U+2013>Wallis H test will be carried out). The default is FALSE.


Number of digits after decimal point (should be an integer) (Default: k = 2).


Scalar between 0 and 1. If unspecified, the defaults return 95% lower and upper confidence intervals (0.95).


A vector of character strings representing the type of intervals required. The value should be any subset of the values "norm", "basic", "perc", "bca". For more, see ?


Number of bootstrap samples for computing confidence interval for the effect size (Default: 100).


A character describing the test being run, which will be added as a prefix in the subtitle. The default is NULL. An example of a stat.title argument will be something like "Student's t-test: ".


Decides whether messages references, notes, and warnings are to be displayed (Default: TRUE).


Additional arguments.


Two-sample Wilcoxon test, also known as Mann-Whitney test, is carried out.

For the two independent samples case, the Mann-Whitney U-test is calculated and W is reported from stats::wilcox.test. For the paired samples case the Wilcoxon signed rank test is run and V is reported.

Since there is no single commonly accepted method for reporting effect size for these tests we are computing and reporting r (computed as \(Z/\sqrt{N}\)) along with the confidence intervals associated with the estimate. Note that N here corresponds to total sample size for independent/between-subjects designs, and to total number of pairs (and not observations) for repeated measures/within-subjects designs.

Note: The stats::wilcox.test function does not follow the same convention as stats::t.test. The sign of the V test statistic will always be positive since it is the sum of the positive signed ranks. Therefore V will vary in magnitude but not significance based solely on the order of the grouping variable. Consider manually reordering your factor levels if appropriate as shown in the second example below.

  • subtitle_mann_nonparametric
  • subtitle_t_nonparametric

# -------------- between-subjects design ------------------------
# simple function call
  data = sleep,
  x = group,
  y = extra

# creating a smaller dataset
msleep_short <- dplyr::filter(
  .data = ggplot2::msleep,
  vore %in% c("carni", "herbi")

# modifying few things
  data = msleep_short,
  x = vore,
  y = sleep_rem,
  nboot = 200,
  conf.level = 0.99,
  conf.type = "bca"

# The order of the grouping factor matters when computing *V*
# Changing default alphabeical order manually
msleep_short$vore <- factor(msleep_short$vore,
  levels = c("herbi", "carni")

# note the change in the reported *V* value but the identical
# value for *p* and the reversed effect size
  data = msleep_short,
  x = vore,
  y = sleep_rem

# -------------- within-subjects design ------------------------
# using dataset included in the package
  data = VR_dilemma,
  x = modality,
  y = score,
  paired = TRUE,
  conf.level = 0.90,
  conf.type = "perc",
  nboot = 200,
  k = 5
# }
Documentation reproduced from package ggstatsplot, version 0.0.11, License: GPL-3 | file LICENSE

Community examples

Looks like there are no examples yet.