Computational Provenance & Reproducibility Record

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

Computational Provenance & Reproducibility Record Randomized Block Design (RBD) · 4.0.0 · DOI 10.5281/zenodo.23587695

Computational Provenance & Reproducibility Record

RAISINS · Randomized Block Design (RBD) Module

This Computational Provenance Record documents the statistical computing environment, software dependencies, computational provenance, and bibliographic references associated with the RAISINS Randomized Block Design (RBD) 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 Randomized Block Design (RBD)
Module Version 4.0.0
DOI 10.5281/zenodo.23587695
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 pf(), pt(), ptukey(), p.adjust(), manova(), shapiro.test()
agricolae 1.3-7 CRAN LSD.test(), HSD.test(), duncan.test()
multcompView 0.1-12 CRAN multcompLetters()
effectsize 1.0.3 CRAN eta_squared()
broom 1.0.13 CRAN tidy()
gtools 3.9.5 CRAN mixedsort(), mixedorder()
dplyr 1.2.1 CRAN group_by(), summarise()
tidyr 1.3.2 CRAN pivot_longer()

3 Statistical Function Registry

Analytical Role Primary Function(s)
Blocked (additive) ANOVA Sums of squares from treatment and block means for the complete balanced layout, with stats::pf() p-values; numerically identical to stats::anova(stats::lm(y ~ Treatment + Block))
Effect size (Cohen’s f) Partial Cohen’s f for the treatment term, sqrt(SS_treatment / SS_error) (equal to effectsize::cohens_f() partial)
Post-hoc mean separation agricolae::LSD.test() (default), agricolae::HSD.test(), agricolae::duncan.test()
Grouping letters Pairwise probabilities from unrounded means and MSE (stats::pt() with stats::p.adjust() for LSD; stats::ptukey() for Tukey and DMRT), letters by multcompView::multcompLetters()
P-value adjustment (LSD) agricolae::LSD.test(..., p.adj =) and stats::p.adjust() for the pairwise probabilities
Grouping-letter ordering gtools::mixedsort()
Multivariate analysis stats::manova(), broom::tidy(), effectsize::eta_squared()
Treatment means & summaries dplyr::group_by(), dplyr::summarise(), tidyr::pivot_longer()
Residual normality stats::shapiro.test() on residuals of the additive treatment + block model
Equal treatment variances Median-based Levene (Brown–Forsythe) screen: one-way ANOVA F of absolute block-adjusted residual deviations from treatment medians, stats::pf()

4 Default Methods & Parameters

Analysis Step / Parameter Default Method / Value
Two-way additive ANOVA Model y ~ Treatment + Block (both taken as factors; no treatment × block interaction, which is the standard RBD assumption). One model fitted per response variable
Design requirement Each treatment occurs exactly once in every block; at least two treatments and two blocks. Duplicate or missing treatment–block observations are reported and must be corrected; no rows are dropped silently
Sums of squares Computed from treatment and block means. For this complete, balanced layout they equal the sequential (Type I), Type II and Type III sums of squares of lm(y ~ Treatment + Block)
Error mean square (MSE) Residual SS ÷ residual df, where residual df = (treatments − 1)(blocks − 1); reused by every post-hoc test
Block term Reported with its own mean square, F and significance marker; blocks are treated as a nuisance factor and receive no post-hoc comparison
Effect size Treatment effect size Partial Cohen's f for the treatment term, sqrt(SS_treatment / SS_error)
Significance & rounding Significance level (α) 0.05 default (user-selectable: 0.05, 0.01)
Significance stars ** for p < 0.01, * for p < 0.05, NS otherwise (fixed thresholds, independent of the selected α; applied to both the treatment and the block row)
P-value display Threshold labels p < 0.001, p < 0.01, p < 0.05, otherwise the rounded value. The Show original numerical p-values option displays the computed p-value to up to 16 significant digits
Rounding 2 decimal places default (user-adjustable digit control, 1–4)
Mean comparison / post-hoc
(agricolae, multcompView)
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 blocked model; alpha = α. Comparisons are made on treatment means only
Grouping display Letters are formed from unrounded pairwise probabilities with multcompView::multcompLetters(), so no significant pair shares a letter. Letters and the CD value are shown only when the treatment p < α; group labels ordered with gtools::mixedsort(); grouping is suppressed when the number of treatments exceeds 80
Critical value reported CD/LSD (LSD), HSD (Tukey), or Duncan critical ranges (DMRT). The trait-wise Individual ANOVA table reports CD at both 5% and 1%
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 row is omitted; the adjusted result is carried by the grouping letters
Standard errors SEM sqrt(MSE / r), where r is the number of blocks (= replications per treatment)
SED sqrt(2 × MSE / r)
Data transformations
(optional, per variable)
Logarithmic Base-10 logarithm with ordered branches for nonpositive values, positive values below 1, or other positive values; see the transformation table below.
Square-root sqrt(x); if any value = 0, sqrt(x + 0.5); blocked on negative values
Arcsine Explicit proportion or percentage units per response; percentage conversion and radians as described below. No endpoint adjustment is applied.
MANOVA
(multi-response mode)
Model & test statistic manova(Y ~ Treatment + Block); Pillai's trace (the stats::manova() default), tidied with broom::tidy(), with partial η² for both terms
Requirement At least two finite numeric responses; residual df (treatments − 1)(blocks − 1) must be at least the number of responses, with nonzero residual variation and full residual column rank after treatment and block adjustment.

5 Transformation Rules

Apply the selected transformation to the entire response variable across all treatments and blocks. Choose only one transformation per response. Rerun the full analysis and recheck assumptions after any change. The uploaded file remains unchanged; table notes identify the analysis scale and formula used.

Transformation Rule Settings and validation
Log: any value ≤ 0 log10(x - min(x) + 1) for the whole response Uses the minimum over all treatments and blocks. This branch has priority over the branches below.
Log: all values > 0, with at least one value < 1 log10(x + c) for the whole response, including observations ≥ 1 Shared constant control: 0 ≤ c ≤ 1, default 1; invalid entries fall back to 1 with a message. c = 0 gives the ordinary log. Positive values below 1 do not mathematically require an offset.
Log: otherwise log10(x) Base 10, not natural logarithm.
Square root sqrt(x + 0.5) for the whole response if any value is zero; otherwise sqrt(x) Negative values block the transformation.
Arcsine square root asin(sqrt(p)), with output in radians Explicit units per response: proportions [0, 1], or percentages [0, 100] converted using p = x/100. Values outside the chosen range are rejected.
Arcsine endpoints 0 and 1 are used as they are asin(sqrt(p)) is defined at both endpoints. No row-count adjustment is applied, because the number of experimental rows is not a binomial denominator. Counts require known totals before conversion to proportions.
All transformations Work on numeric, finite responses; prevent overlapping transformation selections Correct invalid/missing values before running. Do not transform selected observations, treatments or blocks independently.

6 Assumptions Tables

Checks use the response scale fitted by ANOVA, including transformations, and the residuals of the additive treatment + block model. Compare test p-values with the selected significance level. A nonsignificant result does not establish that an assumption holds; independence depends on the experimental design and randomisation.

Table or check Calculation and reported fields Interpretation and limits
Design for diagnostics Each treatment exactly once in every block; finite numeric responses; complete treatment and block labels Otherwise both checks are marked unavailable with a reason. Incomplete rows are not analysed and are disclosed.
Residual normality Shapiro–Wilk on residuals of the additive response ~ treatment + block model; response, n, W, p-value and finding Requires 3–5000 residuals with non-negligible variation; unavailable/failed checks show a reason.
Equal treatment variances Brown–Forsythe (median-based Levene) screen: one-way ANOVA of abs(residual - median(residual within treatment)) across treatments; response, n, F, p-value and finding Requires at least three treatments and three blocks. The p-value is an approximate screen, because block effects were estimated before the deviations were formed. Insufficient variation is reported rather than interpreted as a pass.
Suggested next steps One response-specific guidance row based on findings and response type Suggestions do not apply transformations automatically and retain the block design. Review plots and the response type; rerun the full analysis after any whole-response transformation.
Numerical p-value option Threshold display by default; original computed p-values can be displayed to up to 16 significant digits Display changes do not alter the numerical hypothesis tests.
Report contents HTML, PDF and Word contain both test tables, guidance and explanatory notes Diagnostic plots have separate download controls and are excluded from the table report. The report splits the test results into two five-column tables to avoid overlap.

These diagnostics do not test treatment × block interaction. Residual Q–Q and residual-versus-fitted plots support interpretation but do not certify normality, variance equality or independence.

7 R Code for Key Analytical Steps

The code blocks below demonstrate the exact computation behind each reported result using immer (from the MASS package, which ships with R): Immer’s barley trial, a textbook randomized block design in which 5 varieties are grown at 6 locations acting as blocks, one plot per variety per block, with yields recorded in two years (Y1, Y2).

7.1 Two-Way Additive ANOVA and Effect Size

d <- MASS::immer                                 # 5 varieties x 6 locations (blocks), 30 plots

treatment <- factor(d$Var)                       # treatment factor
block     <- factor(d$Loc)                       # block factor
y         <- d$Y1                                # response variable

# Blocked linear model and ANOVA table. The module computes the same sums of
# squares directly from treatment and block means (one model per response).
model  <- lm(y ~ treatment + block)
result <- anova(model)
result                                           # treatment F = 4.23, p = 0.0121
                                                 # block     F = 21.89, p = 1.75e-07

# Error (residual) mean square and df, reused by the post-hoc tests
MSE   <- result[3, 3]                            # 162.89
dferr <- result[3, 1]                            # 20

# Partial Cohen's f for the treatment term, as reported by the module
sqrt(result[1, 2] / result[3, 2])                # 0.9199

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

alpha <- 0.05                                    # default significance level

# Least Significant Difference (default): agricolae uses the pooled MSE and
# residual df from the blocked model.
out <- agricolae::LSD.test(y, treatment, DFerror = dferr, MSerror = MSE,
                           alpha = alpha, p.adj = "none")
out$statistics                                   # MSerror, Df, Mean, CV, t.value, LSD (= CD)
                                                 # LSD = 15.37

# The module forms the grouping letters from unrounded pairwise probabilities,
# so a significant pair never shares a letter (here: T a; P, V, M, S b).
means <- tapply(y, treatment, mean)
means <- means[order(-means, names(means))]
n_i   <- table(treatment)[names(means)]
pairs <- utils::combn(seq_along(means), 2)
dif   <- abs(means[pairs[1, ]] - means[pairs[2, ]])
se    <- sqrt(MSE * (1 / as.numeric(n_i[pairs[1, ]]) + 1 / as.numeric(n_i[pairs[2, ]])))
p     <- p.adjust(2 * pt(-dif / se, dferr), method = "none")   # LSD; adjustment as selected
P <- matrix(1, length(means), length(means), dimnames = list(names(means), names(means)))
P[t(pairs)] <- p
P <- pmin(P, t(P))
multcompView::multcompLetters(P, compare = "<", threshold = alpha)$Letters

# Letters and the CD value are printed only when the treatment effect is significant:
result[1, 5] < alpha                             # TRUE (p = 0.0121)

# Optional p-value adjustment for LSD (default "none"; selectable: bonferroni, holm, BH).
agricolae::LSD.test(y, treatment, 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, treatment, DFerror = dferr, MSerror = MSE, alpha = alpha)
#   DMRT      -> agricolae::duncan.test(y, treatment, DFerror = dferr, MSerror = MSE, alpha = alpha)

# Standard errors from the pooled MSE (r = number of blocks)
r   <- out$means[1, "r"]                         # 6
SEM <- sqrt(MSE / r)                             # 5.2104
SED <- sqrt(2 * MSE / r)                         # 7.3686

7.3 Assumptions Checks: Residual Normality and Equal Treatment Variances

This example uses the same response scale as the fitted ANOVA. If a transformation is selected, transform the entire response across all treatments and blocks before fitting the model and rerun both checks. The app also reports unavailable tests and reasons for an incomplete block design or insufficient data or variation.

d <- MASS::immer
assumptions_data <- data.frame(
  Treatment = factor(d$Var),
  Block     = factor(d$Loc),
  response  = d$Y1
)
alpha <- 0.05
assumptions_model <- lm(response ~ Treatment + Block, data = assumptions_data)
residual <- residuals(assumptions_model)

# Residual normality: Shapiro-Wilk on residuals of the additive blocked model.
normality <- shapiro.test(residual)
normality_table <- data.frame(
  Response = "Y1", n = nrow(assumptions_data),
  W = unname(normality$statistic), p_value = normality$p.value,   # W = 0.9624, p = 0.3568
  Finding = if (normality$p.value < alpha) "Review normality"
            else "No issue detected"
)
normality_table

# Brown-Forsythe screen: one-way ANOVA of absolute block-adjusted residual
# deviations from treatment medians (approximate p-value).
assumptions_data$deviation <- abs(residual - ave(residual, assumptions_data$Treatment, FUN = median))
variance_check <- anova(lm(deviation ~ Treatment, data = assumptions_data))
variance_table <- data.frame(
  Response = "Y1", n = nrow(assumptions_data),
  F = variance_check$`F value`[1],                                # F = 0.6502
  p_value = variance_check$`Pr(>F)`[1],                           # p = 0.6321
  Finding = if (variance_check$`Pr(>F)`[1] < alpha) "Review variances"
            else "No issue detected"
)
variance_table

The app requires each treatment exactly once in every block. Shapiro–Wilk needs 3–5000 residuals with non-negligible variation, and the Brown–Forsythe screen needs at least three treatments and three blocks. A larger p-value does not prove that an assumption holds; independence must be assessed from the experimental design.

7.4 MANOVA Across Multiple Responses (multi-response mode)

# The app's MANOVA mode requires >= 2 finite response columns and residual df
# (treatments - 1)(blocks - 1) at least the number of responses (here 20 >= 2),
# with nonzero residual variation and full residual rank. Both factors are carried
# over from the univariate model, so the block effect is estimated as well.
Y <- as.matrix(d[, c("Y1", "Y2")])

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

Explore the entire Randomized Block Design (RBD) 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.

8 RAISINS Native Statistical Framework

RAISINS uses R for all its statistical computations. Principal statistical functions are listed with illustrative examples. Exact reproduction also requires the release source, input data, analysis settings and runtime environment. 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.

9 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

Graves, S., Piepho, H.-P., Selzer, L., & Dorai-Raj, S. (2024). multcompView: Visualizations of Paired Comparisons (R package version 0.1-12). https://doi.org/10.32614/CRAN.package.multcompView

Ben-Shachar, M. S., Lüdecke, D., & Makowski, D. (2020). effectsize: Estimation of Effect Size Indices and Standardized Parameters (R package version 1.0.3). 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.13). https://doi.org/10.32614/CRAN.package.broom

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.2.1). https://doi.org/10.32614/CRAN.package.dplyr

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

Venables, W. N., & Ripley, B. D. (2002). Modern Applied Statistics with S (4th ed.). Springer. (MASS R package version 7.3-65). https://doi.org/10.32614/CRAN.package.MASS

Feedback & Discussion