Computational Provenance & Reproducibility Record

RAISINS - R and AI Solutions for INferential Statistics · Online Statistical Analysis Platform for Agricultural Research

Computational Provenance & Reproducibility Record repeated-measures two-way ANOVA · 2.0.0 · DOI 10.5281/zenodo.22104685⟩

Computational Provenance & Reproducibility Record

RAISINS · Repeated-Measures Two-Way ANOVA Module

This Computational Provenance Record documents the statistical computing environment, software dependencies, computational provenance, and bibliographic references associated with the RAISINS Repeated-Measures Two-Way ANOVA 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

Go to the App from here

1 Module Metadata

Parameter Specification
Module Repeated-Measures Two-Way ANOVA
Module Version 2.0.0
DOI 10.5281/zenodo.22104685
Document Type Computational workflow
Statistical Engine R
R Version 4.5.2
Reproducibility Execution Environment: Posit Connect · GCR · renv-locked

2 Statistical Dependency Manifest

Package Version Repository Core Statistical Functions
afex 1.5-1 CRAN aov_car()
car 3.1-5 CRAN Anova() (sphericity-corrected RM table, via afex)
emmeans 2.0.3 CRAN emmeans(), pairs()
multcomp 1.4-30 CRAN cld()
gtools 3.9.5 CRAN mixedsort(), mixedorder()
stats 4.5.2 Base R qt(), qtukey(), aov(), factor(), as.formula()

3 Statistical Function Registry

Analytical Role Primary Function(s)
Repeated-measures ANOVA model fit afex::aov_car()
Sphericity correction (GG / HF) afex::aov_car(anova_table = list(correction = ...)) (via car::Anova)
Effect size Generalized eta-squared, afex::aov_car(anova_table = list(es = "ges"))
Estimated marginal means emmeans::emmeans()
Pairwise comparisons emmeans::pairs()
Compact letter display (grouping) multcomp::cld()
Critical difference (LSD / Tukey) stats::qt(), stats::qtukey()
Result ordering gtools::mixedsort(), gtools::mixedorder()

4 Default Methods & Parameters

Analysis Step / Parameter Default Method / Value
Repeated-Measures
Two-Way ANOVA

(afex::aov_car())
Model Fitted as response ~ Treatment * Day + Error(id/Day), where Day is the within-subject (repeated) factor and id is the subject identifier (the Treatment×Block combination). Reports main effects of Treatment and Day and their interaction
Sphericity correction Default none; optional Greenhouse–Geisser (GG) or Huynh–Feldt (HF) correction to the within-subject degrees of freedom
Effect size Generalized eta-squared (es = "ges") reported alongside each effect
Multiple
Comparison
Test Default LSD (adjust = "none"); TUKEY optional (adjust = "tukey"). Applied to estimated marginal means for Treatment, Day, and the Treatment×Day interaction
Significance level α Default 0.05; 0.01 optional
Letter Grouping
(multcomp::cld())
Method cld(…, Letters = letters, adjust = test, alpha = α). Groups are computed for Treatment (≤ 30 levels) and Day (≤ 30 levels); the Treatment×Day grouping (≤ 50 cells) is shown only when the letter-grouping toggle is enabled
Display rule A factor's letters are shown only when its ANOVA p-value ≤ α; otherwise the grouping column is left blank
Critical
Difference (CD)
LSD qt(1 − α/2, df) × SE
Tukey qtukey(1 − α, nmeans, df) × SE / √2
Rounding Displayed decimals Controlled by the "Digits after decimal" input (default 2, range 1–4). Significance marks and letter groupings are taken from the fitted model's p-values, not from the rounded CD column

5 R Code for Key Analytical Steps

The code blocks below demonstrate the exact computation behind each reported result using the built-in CO2 dataset from the datasets package. CO2 is a balanced repeated-measures design that mirrors the module’s structure: each Plant (the subject id) is measured at all seven conc levels (the within-subject repeated factor, the “Day” analogue) under a single between-subjects Treatment (chilled / nonchilled), with uptake as the response.

5.1 Repeated-Measures Two-Way ANOVA

library(afex)

data(CO2)
dat <- CO2
dat$conc <- factor(dat$conc)   # repeated within-subject factor ("Day" analogue)
# Plant = subject id ; Treatment (chilled / nonchilled) = between-subjects factor

afmod <- afex::aov_car(
  uptake ~ Treatment * conc + Error(Plant / conc),   # mirrors: y ~ Treatment*Day + Error(id/Day)
  data        = dat,
  anova_table = list(correction = "none",  # "GG" or "HF" for sphericity correction
                     es         = "ges")   # generalized eta-squared
)

as.data.frame(afmod$anova_table)   # F, df, ges and p for Treatment, conc, and their interaction

5.2 Estimated Marginal Means & Letter Grouping

library(emmeans)

alpha         <- 0.05
adjust_method <- "none"   # "none" = LSD (default) ; "tukey" = TUKEY

emm_T  <- emmeans(afmod, "Treatment")        # between-subjects marginal means
emm_D  <- emmeans(afmod, "conc")             # within-subjects marginal means
emm_TD <- emmeans(afmod, ~ Treatment:conc)   # interaction marginal means

summary(emm_D)                               # emmean and SE per level

# Compact letter display (grouping); Letters = a, b, c, ...
multcomp::cld(emm_D, Letters = letters, adjust = adjust_method, alpha = alpha)

5.3 Pairwise Comparisons & Critical Difference

# Pairwise contrasts of the estimated marginal means
pw <- as.data.frame(pairs(emm_D, adjust = adjust_method))
pw   # contrast, estimate, SE, df, t.ratio, p.value

# Critical Difference (CD)
# --- LSD (adjust = "none") ---
pw$CD_LSD   <- qt(1 - alpha / 2, pw$df) * pw$SE

# --- Tukey (adjust = "tukey") ---
n_means     <- nrow(as.data.frame(emm_D))
pw$CD_Tukey <- qtukey(1 - alpha, nmeans = n_means, df = pw$df) * pw$SE / sqrt(2)

pw

Explore the entire Repeated-Measures Two-Way ANOVA 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/

Singmann, H., Bolker, B., Westfall, J., Aust, F., & Ben-Shachar, M. S. (2025). afex: Analysis of Factorial Experiments (R package version 1.5-1). https://doi.org/10.32614/CRAN.package.afex

Fox, J., & Weisberg, S. (2026). car: Companion to Applied Regression (R package version 3.1-5). https://doi.org/10.32614/CRAN.package.car

Lenth, R. V. (2026). emmeans: Estimated Marginal Means, aka Least-Squares Means (R package version 2.0.3). https://doi.org/10.32614/CRAN.package.emmeans

Hothorn, T., Bretz, F., & Westfall, P. (2026). multcomp: Simultaneous Inference in General Parametric Models (R package version 1.4-30). https://doi.org/10.32614/CRAN.package.multcomp

Warnes, G. R., Bolker, B., & Lumley, T. (2023). gtools: Various R Programming Tools (R package version 3.9.5). https://doi.org/10.32614/CRAN.package.gtools

Allaire, J. J., Xie, Y., Dervieux, C., McPherson, J., Luraschi, J., Ushey, K., Atkins, A., Wickham, H., Cheng, J., Chang, W., & Iannone, R. (2026). rmarkdown: Dynamic Documents for R (R package version 2.30). https://github.com/rstudio/rmarkdown

Feedback & Discussion