Calculates Glass rank biserial correlation coefficient effect size for Mann-Whitney two-sample rank-sum test, or a table with an ordinal variable and a nominal variable with two levels; confidence intervals by bootstrap.
wilcoxonRG(
x,
g = NULL,
group = "row",
ci = FALSE,
conf = 0.95,
type = "perc",
R = 1000,
histogram = FALSE,
digits = 3,
reportIncomplete = FALSE,
verbose = FALSE,
na.last = NA,
...
)
A single statistic, rg. Or a small data frame consisting of rg, and the lower and upper confidence limits.
Either a two-way table or a two-way matrix. Can also be a vector of observations.
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.
If x
is a table or matrix, group
indicates whether
the "row"
or the "column"
variable is
the nominal, grouping variable.
If TRUE
, returns confidence intervals by bootstrap.
May be slow.
The level for the confidence interval.
The type of confidence interval to use.
Can be any of "norm
", "basic
",
"perc
", or "bca
".
Passed to boot.ci
.
The number of replications to use for bootstrap.
If TRUE
, produces a histogram of bootstrapped values.
The number of significant digits in the output.
If FALSE
(the default),
NA
will be reported in cases where there
are instances of the calculation of the statistic
failing during the bootstrap procedure.
If TRUE
, prints information on factor levels and ranks.
Passed to rank
. For example, can be set to
TRUE
to assign NA
values a minimum rank.
Additional arguments passed to rank
Salvatore Mangiafico, mangiafico@njaes.rutgers.edu
rg is calculated as 2 times the difference of mean of ranks for each group divided by the total sample size. It appears that rg is equivalent to Cliff's delta.
NA
values can be handled by the rank
function.
In this case, using verbose=TRUE
is helpful
to understand how the rg
statistic is calculated.
Otherwise, it is recommended that NA
s be removed
beforehand.
When the data in the first group are greater than in the second group, rg is positive. When the data in the second group are greater than in the first group, rg is negative.
Be cautious with this interpretation, as R will alphabetize
groups if g
is not already a factor.
When rg is close to extremes, or with small counts in some cells, the confidence intervals determined by this method may not be reliable, or the procedure may fail.
King, B.M., P.J. Rosopa, and E.W. Minium. 2011. Statistical Reasoning in the Behavioral Sciences, 6th ed.
wilcoxonR
data(Breakfast)
Table = Breakfast[1:2,]
library(coin)
chisq_test(Table, scores = list("Breakfast" = c(-2, -1, 0, 1, 2)))
wilcoxonRG(Table)
data(Catbus)
wilcox.test(Steps ~ Gender, data = Catbus)
wilcoxonRG(x = Catbus$Steps, g = Catbus$Gender)
### Example from King, Rosopa, and Minium
Criticism = c(-3, -2, 0, 0, 2, 5, 7, 9)
Praise = c(0, 2, 3, 4, 10, 12, 14, 19, 21)
Y = c(Criticism, Praise)
Group = factor(c(rep("Criticism", length(Criticism)),
rep("Praise", length(Praise))))
wilcoxonRG(x = Y, g = Group, verbose=TRUE)
Run the code above in your browser using DataLab