Kendall's W with bootstrapped confidence interval
kendallW.RdCalculates Kendall's W coefficient of concordance,
which can be used as an effect size statistic for
unreplicated complete block design
such as where Friedman's test might be used.
This function is a wrapper for the KendallW
function in the DescTools package,
with the addition of bootstrapped
confidence intervals.
Usage
kendallW(
x,
correct = TRUE,
na.rm = FALSE,
ci = FALSE,
conf = 0.95,
type = "perc",
R = 1000,
histogram = FALSE,
digits = 3,
...
)Arguments
- x
A k x m matrix or table, with k treatments in rows and m raters or blocks in columns.
- correct
Passed to
KendallW.- na.rm
Passed to
KendallW.- 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
KendallWfunction.
Value
A single statistic, W. Or a small data frame consisting of W, and the lower and upper confidence limits.
Details
See the KendallW function in the DescTools package
for details.
When W is close to 0 or very large, or with small sample size, the confidence intervals determined by this method may not be reliable, or the procedure may fail.
Because W is always positive, if type="perc",
the confidence interval will
never cross zero, and should not
be used for statistical inference.
However, if type="norm", the confidence interval
may cross zero.
When producing confidence intervals by bootstrap, this function treats each rater or block as an observation. It is not clear to the author if this approach produces accurate confidence intervals, but it appears to be reasonable.
Acknowledgments
My thanks to Indrajeet Patil, author of ggstatsplot,
and groupedstats for help in the inspiring and
coding of this function.
Author
Salvatore Mangiafico, mangiafico@njaes.rutgers.edu