Matched-pairs rank biserial correlation coefficient
wilcoxonPairedRC.RdCalculates 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,
...
)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 toboot.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
Value
A single statistic, rc. Or a small data frame consisting of rc, and the lower and upper confidence limits.
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.
Author
Salvatore Mangiafico, mangiafico@njaes.rutgers.edu
Examples
data(Pooh)
Time1 = Pooh$Likert[Pooh$Time==1]
Time2 = Pooh$Likert[Pooh$Time==2]
wilcox.test(x = Time1, y = Time2, paired=TRUE, exact=FALSE)
#>
#> Wilcoxon signed rank test with continuity correction
#>
#> data: Time1 and Time2
#> V = 3.5, p-value = 0.02355
#> alternative hypothesis: true location shift is not equal to 0
#>
wilcoxonPairedRC(x = Pooh$Likert, g = Pooh$Time)
#> rc
#> -0.844
### 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)
#> rc
#> 0.764
### 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")
#>
#> Levels: A B
#> zero.method: Wilcoxon
#> n kept = 8
#> Ranks plus = 22.5
#> Ranks minus = 13.5
#> T value = 13.5
#>
#> rc
#> -0.25
wilcoxonPairedRC(x = Y, g = Group, verbose=TRUE, zero.method="Pratt")
#>
#> Levels: A B
#> zero.method: Pratt
#> n kept = 8
#> Ranks plus = 34.5
#> Ranks minus = 17.5
#> T value = 17.5
#>
#> rc
#> -0.472
wilcoxonPairedRC(x = Y, g = Group, verbose=TRUE, zero.method="none")
#>
#> Levels: A B
#> zero.method: none
#> n kept = 10
#> Ranks plus = 34.5
#> Ranks minus = 17.5
#> T value = 17.5
#>
#> rc
#> -0.309