View source: R/nonparametric.R View source: R/zzz-r4vn-inference.R
| kwallis | R Documentation |
Performs the Kruskal-Wallis rank-sum test for a numeric outcome across two or
more independent groups. Optional Dunn or pairwise Wilcoxon post-hoc tests
and rank-based effect sizes can be requested. With by = vars(region, sex, treatment), region and sex are nested strata and treatment is the innermost
Kruskal-Wallis factor.
kwallis(
x, by, data = NULL, posthoc = c("none", "dunn", "wilcoxon"),
adjust = "holm", effect = FALSE, digits = 3, p_digits = 3, show = TRUE,
console = FALSE
)
x |
Numeric outcome. |
by |
Grouping variable with at least two observed groups, or hierarchical |
data |
Data frame. If |
posthoc |
Post-hoc method: |
adjust |
Multiplicity adjustment accepted by |
effect |
Logical; add epsilon-squared and eta-squared(H). |
digits, p_digits |
Decimal places for estimates and p-values. |
show |
Logical; open the formatted result in the Viewer. Default |
console |
Logical; also print the traditional result in the Console. Default |
Invisibly returns an object of class r4vn_stat.
d <- data.frame(
score = c(10, 12, 11, 18, 17, 20, 25, 24, 27),
group = factor(rep(c("A", "B", "C"), each = 3))
)
kwallis(score, by = group, data = d, posthoc = "dunn", effect = TRUE)
# Extended usage examples
d <- data.frame(
score = c(10, 12, 11, 18, 17, 20, 25, 24, 27),
treatment = factor(rep(c("A", "B", "C"), each = 3))
)
kwallis(score, by = treatment, data = d)
usedf(d)
result <- kwallis(score, by = treatment, show = FALSE)
result$raw$test
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.