This Computational Provenance Record documents the statistical computing environment, software dependencies, computational provenance, and bibliographic references associated with the RAISINS Kruskal-Wallis Test module. It is intended to support computational reproducibility and software transparency. Detailed statistical methodology, mathematical derivations, and user guidance are provided separately in the official module documentation.
Any issues or updates required please comment here
Mean rank per group (LSD method) & compact letter grouping (LSD method)
agricolae::kruskal(group = TRUE)
Mean rank per group only (Dunn’s test method)
agricolae::kruskal(group = FALSE)
Post-hoc pairwise comparison (Dunn’s test method)
FSA::dunnTest()
Compact letter grouping from pairwise p-values (Dunn’s test method)
multcompView::multcompLetters()
Descriptive statistics (mean, SD) per group per response variable
base::mean(), stats::sd()
4 Default Methods & Parameters
Analysis
Step / Parameter
Default Method / Value
Kruskal-Wallis
H-test
Test
Rank-based, distribution-free k-sample test via stats::kruskal.test(); tests whether the response variable's distribution differs across the levels of the selected grouping (Treatment) column. Applied independently, per selected response variable
Significance level
User-selectable via a "Level of significance (α)" control; α = 0.05 (default) or 0.01
Significance stars
p ≤ 0.01 → **; p ≤ 0.05 → *; otherwise NS (not significant)
Multiple Comparison
Test
Dunn's test (default)
Pairwise rank-sum comparisons via FSA::dunnTest(), using the pooled rank variance across all groups; p-value adjustment method user-selectable (default none; also offers bonferroni, sidak, holm, hs, hochberg, bh, by). Only performed when the overall Kruskal-Wallis test is significant at the chosen α
LSD (least significant rank difference)
Pairwise comparison of mean ranks via agricolae::kruskal(group = TRUE); p-value adjustment method user-selectable (default none; also offers holm, hommel, hochberg, bonferroni, BH, BY, fdr). Only performed when the overall Kruskal-Wallis test is significant at the chosen α
Compact Letter
Grouping
Construction
For Dunn's test, the pairwise adjusted p-values are assembled into a symmetric comparison matrix (rows/columns ordered by descending mean rank, so "a" marks the highest-ranked group) and passed to multcompView::multcompLetters(threshold = α). For LSD, the letters are taken directly from agricolae::kruskal()'s own grouping output. Groups sharing at least one letter are not significantly different
Descriptive
Statistics
Per group, per response variable
Mean and standard deviation, computed via base::mean()/stats::sd() on the raw (unranked) values within each group
Mean rank display
Optional - a "Show mean ranks" toggle appends each group's mean rank (from agricolae::kruskal()) alongside the mean ± SD in the results table
Results Table
Display
Cell format
Toggleable between "mean ± std" and mean-only display; results rounded to the user-selected number of decimal places (default 2)
Letter grouping display
Optional - a "Show Letter Grouping" toggle controls whether the compact letter grouping superscripts (and the corresponding footnote) are shown in the on-screen results table and in the downloadable report (HTML/PDF/Word), independently of whether the letters were computed
Plots
Box, Violin, Mean Value, Connected Line, Bar, Summary, Raincloud, Advanced Raincloud, Circular, QQ, Distribution, Pair, Correlation
13 plot types built from the same per-group summary statistics and compact letter groupings as the results table, so a letter or value shown in a plot is always traceable to the same underlying computation as the table
5 R Code for Key Analytical Steps
The code blocks below demonstrate the exact computation behind each reported result, using the module’s own bundled worked example (dataset1.csv: 4 varieties V1-V4, 5 sensory response variables - Appearance, Color, Texture, Taste, Flavour - rated 1-5 by judges).
5.1 Kruskal-Wallis H-test
df <-read.csv("dataset1.csv")response <- df$Appearancetreatment <-factor(df$Groups)kw <-kruskal.test(response ~ treatment)kw$statistic # H (chi-squared) statistickw$parameter # degrees of freedomkw$p.valuealpha <-0.05# user-selectable in the app: 0.05 (default) or 0.01
5.2 Post-hoc: Dunn’s Test (default) with Compact Letter Grouping
library(FSA)library(multcompView)dunn <- FSA::dunnTest(response ~ treatment, method ="none") # method is user-selectablepvals <- dunn$resgroups <-levels(treatment)comparison_matrix <-matrix(1, nrow =length(groups), ncol =length(groups),dimnames =list(groups, groups))for (i inseq_len(nrow(pvals))) {# matched against the known group names rather than split on " - ", so a group# whose own name contains " - " cannot corrupt the matrix comp <-strsplit(pvals$Comparison[i], " - ", fixed =TRUE)[[1]]if (!(length(comp) ==2&&all(comp %in% groups))) { comp <-unlist(lapply(groups, function(a) { b <-sub(paste0("^", a, " - "), "", pvals$Comparison[i])if (b != pvals$Comparison[i] && b %in% groups) c(a, b) })) } comparison_matrix[comp[1], comp[2]] <- pvals$P.adj[i] comparison_matrix[comp[2], comp[1]] <- pvals$P.adj[i]}# Reordered by descending mean rank before grouping, so "a" marks the# highest-ranked group (matching the convention agricolae::kruskal() uses)letters <- multcompView::multcompLetters(comparison_matrix, threshold = alpha)letters$Letters
library(agricolae)lsd <- agricolae::kruskal(response, treatment,alpha = alpha,p.adj ="none", # user-selectablegroup =TRUE,console =FALSE)lsd$groups # mean rank + compact letter grouping, one row per grouplsd$statistics # Chi-squared and its p-value
5.4 Mean Rank (for the optional “Show mean ranks” display)
mean_rank <- agricolae::kruskal(response, treatment,alpha = alpha, p.adj ="none",group =FALSE, console =FALSE)mean_rank$means # mean rank per group, used regardless of Dunn's/LSD selection
Explore the entire Kruskal-Wallis Test module in preview mode using our demo datasets. To submit suggestions or report a workflow issue, please use the discussion section below, or visit the official RAISINS website.
6 RAISINS Native Statistical Framework
RAISINS uses R for all its statistical computations. Every package used to generate major results is listed and demonstrated with examples, so results can be reproduced independently. These results are then organized and formatted on the RAISINS website along with visualisation to make them easier to use and interpret. RAISINS also has its own custom-built statistical tools for managing workflows, validating results, and generating reports. Details of these are not fully covered here, they’re shared with outside researchers only on request, and are subject to licensing terms.
7 Package References
R Core Team. (2025). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. https://www.R-project.org/
Mendiburu, F. de. (2023). agricolae: Statistical Procedures for Agricultural Research (R package version 1.3-7). https://CRAN.R-project.org/package=agricolae
Ogle, D. H., Doll, J. C., Wheeler, A. P., & Dinno, A. (2025). FSA: Simple Fisheries Stock Assessment Methods (R package version 0.10.1). https://CRAN.R-project.org/package=FSA
Graves, S., Piepho, H.-P., Selzer, L., & Dorai-Raj, S. (2019). multcompView: Visualizations of Paired Comparisons (R package version 0.1-12). https://CRAN.R-project.org/package=multcompView
Kruskal, W. H., & Wallis, W. A. (1952). Use of Ranks in One-Criterion Variance Analysis. Journal of the American Statistical Association, 47(260), 583-621. https://doi.org/10.1080/01621459.1952.10483441
Dunn, O. J. (1964). Multiple Comparisons Using Rank Sums. Technometrics, 6(3), 241-252. https://doi.org/10.1080/00401706.1964.10490181