Learn R Programming

rcompanion (version 2.4.30)

wilcoxonPairedRC: Matched-pairs rank biserial correlation coefficient

Description

Calculates matched-pairs rank biserial correlation coefficient effect size for paired Wilcoxon signed-rank test; confidence intervals by bootstrap.

Usage

wilcoxonPairedRC(
  x,
  g = NULL,
  zero.method = "Wilcoxon",
  ci = FALSE,
  conf = 0.95,
  type = "perc",
  R = 1000,
  histogram = FALSE,
  digits = 3,
  verbose = FALSE,
  ...
)

Value

A single statistic, rc. Or a small data frame consisting of rc, and the lower and upper confidence limits.

Arguments

x

A vector of observations.

g

The vector of observations for the grouping, nominal variable. Only the first two levels of the nominal variable are used.

zero.method

If "Wilcoxon", differences of zero are discarded and then ranks are determined. If "Pratt", ranks are determined, and then differences of zero are discarded. If "none", differences of zero are not discarded.

ci

If TRUE, returns confidence intervals by bootstrap. May be slow.

conf

The level for the confidence interval.

type

The type of confidence interval to use. Can be any of "norm", "basic", "perc", or "bca". Passed to boot.ci.

R

The number of replications to use for bootstrap.

histogram

If TRUE, produces a histogram of bootstrapped values.

digits

The number of significant digits in the output.

verbose

If TRUE, prints information on sample size and ranks.

...

Additional arguments passed to rank

Author

Salvatore Mangiafico, mangiafico@njaes.rutgers.edu

Details

It is recommended that NAs be removed beforehand.

When the data in the first group are greater than in the second group, rc is positive. When the data in the second group are greater than in the first group, rc is negative.

Be cautious with this interpretation, as R will alphabetize groups if g is not already a factor.

When rc 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.

References

King, B.M., P.J. Rosopa, and E.W. Minium. 2011. Statistical Reasoning in the Behavioral Sciences, 6th ed.

https://rcompanion.org/handbook/F_06.html

See Also

wilcoxonPairedR

Examples

Run this code
data(Pooh)
wilcox.test(Likert ~ Time, data=Pooh, paired=TRUE, exact=FALSE)
wilcoxonPairedRC(x = Pooh$Likert, g = Pooh$Time)

### Example from King, Rosopa, and Minium
Placebo = c(24,39,29,28,25,32,31,33,31,22)
Drug    = c(28,29,34,21,28,15,17,28,16,12)
Y = c(Placebo, Drug)
Group = factor(c(rep("Placebo", length(Placebo)),  
                 rep("Drug", length(Drug))), 
                 levels=c("Placebo", "Drug"))
wilcoxonPairedRC(x = Y, g = Group)

### Example with some zero differences
A = c(11,12,13,14,15,16,17,18,19,20)
B = c(12,14,16,18,20,22,12,10,19,20)
Y = c(A, B)
Group = factor(c(rep("A", length(A)),  
                 rep("B", length(B))))
wilcoxonPairedRC(x = Y, g = Group, verbose=TRUE, zero.method="Wilcoxon")
wilcoxonPairedRC(x = Y, g = Group, verbose=TRUE, zero.method="Pratt")
wilcoxonPairedRC(x = Y, g = Group, verbose=TRUE, zero.method="none")

Run the code above in your browser using DataLab