[Stable]

A function for TOST using the non-parametric methods of the Wilcoxon-Mann-Whitney family of tests. This function uses the normal approximation and applies a continuity correction automatically.

wilcox_TOST(
  x,
  ...,
  hypothesis = "EQU",
  paired = FALSE,
  eqb,
  low_eqbound,
  high_eqbound,
  ses = "rb",
  alpha = 0.05
)

# S3 method for default
wilcox_TOST(
  x,
  y = NULL,
  hypothesis = "EQU",
  paired = FALSE,
  eqb,
  low_eqbound,
  high_eqbound,
  ses = c("rb", "odds", "cstat"),
  alpha = 0.05,
  mu = 0,
  ...
)

# S3 method for formula
wilcox_TOST(formula, data, subset, na.action, ...)

Arguments

x

a (non-empty) numeric vector of data values.

...

further arguments to be passed to or from methods.

hypothesis

'EQU' for equivalence (default), or 'MET' for minimal effects test, the alternative hypothesis.

paired

a logical indicating whether you want a paired t-test.

eqb

Equivalence bound. Can provide 1 value (negative value is taken as the lower bound) or 2 specific values that represent the upper and lower equivalence bounds.

low_eqbound

lower equivalence bounds (deprecated).

high_eqbound

upper equivalence bounds (deprecated).

ses

Standardized effect size. Default is "rb" for rank-biserial correlation. Options also include "cstat" for concordance probability, or "odds" for Wilcoxon-Mann-Whitney odds (otherwise known as Agresti's generalized odds ratio).

alpha

alpha level (default = 0.05)

y

an optional (non-empty) numeric vector of data values.

mu

number indicating the value around which (a-)symmetry (for one-sample or paired samples) or shift (for independent samples) is to be estimated. See stats::wilcox.test.

formula

a formula of the form lhs ~ rhs where lhs is a numeric variable giving the data values and rhs either 1 for a one-sample or paired test or a factor with two levels giving the corresponding groups. If lhs is of class "Pair" and rhs is 1, a paired test is done.

data

an optional matrix or data frame (or similar: see model.frame) containing the variables in the formula formula. By default the variables are taken from environment(formula).

subset

an optional vector specifying a subset of observations to be used.

na.action

a function which indicates what should happen when the data contain NAs. Defaults to getOption("na.action").

Value

An S3 object of class "TOSTnp" is returned containing the following slots:

  • "TOST": A table of class "data.frame" containing two-tailed wilcoxon signed rank test and both one-tailed results.

  • "eqb": A table of class "data.frame" containing equivalence bound settings.

  • "effsize": table of class "data.frame" containing effect size estimates.

  • "hypothesis": String stating the hypothesis being tested.

  • "smd": List containing information on standardized effect size.

  • "alpha": Alpha level set for the analysis.

  • "method": Type of non-parametric test.

  • "decision": List included text regarding the decisions for statistical inference.

Details

For details on the calculations in this function see vignette("robustTOST").

If only x is given, or if both x and y are given and paired is TRUE, a Wilcoxon signed rank test of the null that the distribution of x (in the one sample case) or of x - y (in the paired two sample case) is symmetric about mu is performed.

Otherwise, if both x and y are given and paired is FALSE, a Wilcoxon rank sum test (equivalent to the Mann-Whitney test: see the Note) is carried out. In this case, the null hypothesis is that the distributions of x and y differ by a location shift.

References

David F. Bauer (1972). Constructing confidence sets using rank statistics. Journal of the American Statistical Association 67, 687–690. doi: 10.1080/01621459.1972.10481279.

Myles Hollander and Douglas A. Wolfe (1973). Nonparametric Statistical Methods. New York: John Wiley & Sons. Pages 27–33 (one-sample), 68–75 (two-sample). Or second edition (1999).

See also

Examples

data(mtcars)
wilcox_TOST(mpg ~ am,
data = mtcars,
eqb = 3)
#> 
#> Wilcoxon rank sum test with continuity correction
#> 
#> The equivalence test was non-significant W = 18.500, p = 9.75e-01
#> The null hypothesis test was significant W = 42.000, p = 1.87e-03
#> NHST: reject null significance hypothesis that the effect is equal to zero 
#> TOST: don't reject null equivalence hypothesis
#> 
#> TOST Results 
#>            Test Statistic p.value
#> NHST                 42.0   0.002
#> TOST Lower           73.0   0.975
#> TOST Upper           18.5 < 0.001
#> 
#> Effect Sizes 
#>                           Estimate                C.I. Conf. Level
#> Median of Differences      -6.8000 [-10.9999, -3.6001]         0.9
#> Rank-Biserial Correlation  -0.6599  [-0.8143, -0.4182]         0.9
#> 
#>