Computational Provenance & Reproducibility Record

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

Computational Provenance & Reproducibility Record Two-Factor Factorial CRD · 2.0.0 · DOI 10.5281/zenodo.XXXXXXX

Computational Provenance & Reproducibility Record

RAISINS · Two-Factor Factorial CRD Module

This Computational Provenance Record documents the statistical computing environment, software dependencies, computational provenance, and bibliographic references associated with the RAISINS Two-Factor Factorial CRD 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 Two-Factor Factorial CRD
Module Version 2.0.0
DOI —–
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
stats 4.5.2 Base R lm(), manova(), residuals(), shapiro.test(), ks.test(), p.adjust()
car 3.1-3 CRAN Anova() (Type II sums of squares)
agricolae 1.3-7 CRAN LSD.test(), HSD.test(), duncan.test()
effectsize 1.0.1 CRAN cohens_f(), eta_squared()
broom 1.0.8 CRAN tidy()
nortest 1.0-4 CRAN ad.test()
gtools 3.9.5 CRAN mixedsort()
dplyr 1.1.4 CRAN group_by(), summarise()
tidyr 1.3.1 CRAN pivot_longer()

3 Statistical Function Registry

Analytical Role Primary Function(s)
Factorial linear model stats::lm(y ~ A + B + A:B)
ANOVA table (Type II SS) car::Anova(model, type = "II")
Effect size (per term) effectsize::cohens_f() (ANOVA); effectsize::eta_squared() (MANOVA)
Post-hoc mean separation agricolae::LSD.test() (default), agricolae::HSD.test(), agricolae::duncan.test()
P-value adjustment (LSD) agricolae::LSD.test(..., p.adj =); alternatively stats::p.adjust()
Grouping-letter ordering gtools::mixedsort()
Normality diagnostics (residuals) stats::shapiro.test(), nortest::ad.test(), stats::ks.test()
Multivariate analysis stats::manova(), broom::tidy()
Treatment means & summaries dplyr::group_by(), dplyr::summarise(), tidyr::pivot_longer()

4 Default Methods & Parameters

Analysis Step / Parameter Default Method / Value
Factorial ANOVA
(lm() + car::Anova())
Model y ~ A + B + A:B (two crossed factors A, B and their interaction; A, B, A×B taken as factors)
Sums of squares Type II, via car::Anova(model, type = "II")
Error mean square (MSE) Residual SS ÷ residual df from the fitted model
Effect size
(effectsize::cohens_f())
Term effect size Partial Cohen's f, reported for A, B and A×B
Significance & rounding Significance level (α) 0.05 default (user-selectable: 0.05, 0.01)
Rounding 2 decimal places default (user-adjustable digit control)
Mean comparison / post-hoc
(agricolae)
Default method LSD — agricolae::LSD.test() (alternatives: Tukey HSD HSD.test(); DMRT duncan.test())
Inputs to the test Pooled MSerror = MSE and DFerror = residual df from the factorial model; alpha = α
Grouping display Letters shown only when the factor's ANOVA p ≤ α; group labels ordered with gtools::mixedsort()
Critical value reported CD/LSD (LSD), HSD (Tukey), or Duncan critical ranges (DMRT), applied to A, B and A×B
P-value adjustment
(LSD only, LSD.test(p.adj =))
Method none default (user-selectable: bonferroni, holm, BH)
Reporting under adjustment A single CD/critical difference is not defined once comparisons are adjusted, so the CD and per-factor p-value rows are omitted; the adjusted result is carried by the grouping letters
Standard errors SEM sqrt(MSE / r) (balanced replication only; reported as “-” when replication is unequal)
SED sqrt(2 × MSE / r) (balanced replication only)
Normality diagnostics
(on model residuals)
Default test Shapiro–Wilk shapiro.test() (3 ≤ n ≤ 5000)
Data transformations
(optional, per variable)
Logarithmic log10(x); if any value ≤ 0, log10(x - min(x) + 1)
Square-root sqrt(x); if any value = 0, sqrt(x + 0.5); blocked on negative values
Arcsine asin(sqrt(x)) on proportions in [0, 1]; 0 and 1 replaced by 1/(4n) and 1 - 1/(4n)

5 R Code for Key Analytical Steps

The code blocks below demonstrate the exact computation behind each reported result using the warpbreaks dataset (built into the datasets package): a balanced two-factor factorial with wool (2 levels) crossed with tension (3 levels), 9 replicates per cell, and the number of breaks as the response.

5.1 Factorial ANOVA (Type II) and Effect Size

data(warpbreaks)
d <- warpbreaks                                  # breaks ~ wool (A) x tension (B), 2 x 3, balanced

A  <- factor(d$wool)                             # Factor A
B  <- factor(d$tension)                          # Factor B
AB <- factor(paste(d$wool, d$tension, sep = ":"))# A x B interaction cell (AxB)
y  <- d$breaks                                   # response variable

# Full factorial linear model and Type II ANOVA (mirrors the module)
model  <- lm(y ~ A + B + A:B)
result <- as.data.frame(car::Anova(model, type = "II"))
result

# Error (residual) mean square, reused by the post-hoc tests
MSE <- result[4, 1] / result[4, 2]

# Partial Cohen's f effect size for A, B and A:B
effectsize::cohens_f(model)

5.2 Post-hoc Mean Comparison (LSD default; Tukey / DMRT alternatives)

alpha <- 0.05                                    # default significance level
dferr <- result[4, 2]                            # residual degrees of freedom

# Least Significant Difference (default): agricolae uses the pooled MSE and
# residual df from the factorial model; grouping letters ordered with mixedsort.
outA  <- agricolae::LSD.test(y, A,  DFerror = dferr, MSerror = MSE, alpha = alpha)
outB  <- agricolae::LSD.test(y, B,  DFerror = dferr, MSerror = MSE, alpha = alpha)
outAB <- agricolae::LSD.test(y, AB, DFerror = dferr, MSerror = MSE, alpha = alpha)

outA$groups[gtools::mixedsort(rownames(outA$groups)), ]

# Optional p-value adjustment for LSD (default "none"; selectable: bonferroni, holm, BH).
# agricolae applies the correction internally and recomputes the grouping letters.
agricolae::LSD.test(y, A, DFerror = dferr, MSerror = MSE, alpha = alpha,
                    p.adj = "bonferroni")$groups

# Alternatives selectable in the app (same DFerror / MSerror / alpha arguments):
#   Tukey HSD -> agricolae::HSD.test(y, A, DFerror = dferr, MSerror = MSE, alpha = alpha)
#   DMRT      -> agricolae::duncan.test(y, A, DFerror = dferr, MSerror = MSE, alpha = alpha)

# Standard errors from the pooled MSE (r = replications per factor level)
r   <- outA$means[1, 3]
SEM <- sqrt(MSE / r)
SED <- sqrt(2 * MSE / r)

5.3 MANOVA Across Multiple Responses (multi-response mode)

# The app's MANOVA mode requires >= 2 response columns (one per measured trait).
# Illustrated here with two response columns built from the same design.
Y <- cbind(breaks     = warpbreaks$breaks,
           log_breaks = log1p(warpbreaks$breaks))

res.man <- manova(as.matrix(Y) ~ A + B + A:B)
broom::tidy(res.man)                             # Pillai's trace per term
effectsize::eta_squared(res.man)                 # partial eta-squared per term

Explore the entire Two-Factor Factorial CRD 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/

de Mendiburu, F. (2023). agricolae: Statistical Procedures for Agricultural Research (R package version 1.3-7). https://doi.org/10.32614/CRAN.package.agricolae

Fox, J., & Weisberg, S. (2019). An R Companion to Applied Regression (3rd ed.). Sage. (car R package version 3.1-3). https://doi.org/10.32614/CRAN.package.car

Ben-Shachar, M. S., Lüdecke, D., & Makowski, D. (2020). effectsize: Estimation of Effect Size Indices and Standardized Parameters (R package version 1.0.1). https://doi.org/10.32614/CRAN.package.effectsize

Robinson, D., Hayes, A., & Couch, S. (2025). broom: Convert Statistical Objects into Tidy Tibbles (R package version 1.0.8). https://doi.org/10.32614/CRAN.package.broom

Gross, J., & Ligges, U. (2015). nortest: Tests for Normality (R package version 1.0-4). https://doi.org/10.32614/CRAN.package.nortest

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

Wickham, H., François, R., Henry, L., Müller, K., & Vaughan, D. (2023). dplyr: A Grammar of Data Manipulation (R package version 1.1.4). https://doi.org/10.32614/CRAN.package.dplyr

Wickham, H., Vaughan, D., & Girlich, M. (2024). tidyr: Tidy Messy Data (R package version 1.3.1). https://doi.org/10.32614/CRAN.package.tidyr

Feedback & Discussion