Learn R Programming

rcompanion (version 1.13.2)

wilcoxonR: r effect size for Wilcoxon two-sample rank-sum test

Description

Calculates r effect size for Mann-Whitney, two-sample rank-sum test, or a table with an ordinal variable and a nominal variable with two levels.

Usage

wilcoxonR(x, g = NULL, group = "row", digits = 3, ...)

Arguments

x

Either a two-way table or a two-way matrix. Can also be a vector of observations of an ordinal variable.

g

If x is a vector, g is the vector of observations for the grouping, nominal variable. Only the first two levels of the nominal variable are used.

group

If x is a table or matrix, group indicates whether the "row" or the "column" variable is the nominal, grouping variable.

digits

The number of significant digits in the output.

...

Additional arguments passed to the wilcox_test function.

Value

A single statistic, r

Details

A Z value is extracted from the wilcox_test function in the coin package. r is calculated as Z divided by square root of the total observations.

Currently, the function makes no provisions for NA values in the data. It is recommended that NAs be removed beforehand.

References

http://rcompanion.org/handbook/F_04.html

See Also

freemanTheta

Examples

Run this code
# NOT RUN {
data(Breakfast)
Table = Breakfast[1:2,]
library(coin)
chisq_test(Table, scores = list("Breakfast" = c(-2, -1, 0, 1, 2)))
wilcoxonR(Table)

data(PoohPiglet)
Data = PoohPiglet[PoohPiglet$Speaker %in% c("Pooh", "Piglet"),]
wilcox.test(Likert ~ Speaker, data = Data)
wilcoxonR(x = Data$Likert, g = Data$Speaker)

# }

Run the code above in your browser using DataLab