r effect size for Wilcoxon one-sample signed-rank test
wilcoxonOneSampleR.RdCalculates r effect size for a Wilcoxon one-sample signed-rank test; confidence intervals by bootstrap.
Usage
wilcoxonOneSampleR(
x,
mu = NULL,
adjustn = TRUE,
coin = FALSE,
ci = FALSE,
conf = 0.95,
type = "perc",
R = 1000,
histogram = FALSE,
digits = 3,
...
)Arguments
- x
A vector of observations.
- mu
The value to compare
xto, as inwilcox.test- adjustn
If
TRUE, reduces the sample size in the calculation ofrby the number of observations equal tomu.- coin
If
FALSE, the default, the Z value is extracted from a function similar to thewilcox.testfunction in the stats package. IfTRUE, the Z value is extracted from thewilcox_testfunction in the coin package. This method may be much slower, especially if a confidence interval is produced.- 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.
- ...
Additional arguments passed to the
wilcoxsign_testfunction.
Value
A single statistic, r. Or a small data frame consisting of r, and the lower and upper confidence limits.
Details
r is calculated as Z divided by square root of the number of observations.
The calculated statistic is equivalent to the statistic returned
by the wilcoxPairedR function with one group equal
to a vector of mu.
The author knows of no reference for this technique.
This statistic typically reports a smaller effect size
(in absolute value) than does
the matched-pairs rank biserial correlation coefficient
(wilcoxonOneSampleRC), and may not reach a value
of -1 or 1 if there are values tied with mu.
Currently, the function makes no provisions for NA
values in the data. It is recommended that NAs be removed
beforehand.
When the data are greater than mu, r is positive.
When the data are less than mu, r is negative.
When r 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.
Acknowledgments
My thanks to
Peter Stikker for the suggestion to adjust the sample size
for ties with mu.
Author
Salvatore Mangiafico, mangiafico@njaes.rutgers.edu
Examples
X = c(1,2,3,3,3,3,4,4,4,4,4,5,5,5,5,5)
wilcox.test(X, mu=3, exact=FALSE)
#>
#> Wilcoxon signed rank test with continuity correction
#>
#> data: X
#> V = 65, p-value = 0.03973
#> alternative hypothesis: true location is not equal to 3
#>
wilcoxonOneSampleR(X, mu=3)
#> r
#> 0.606