Computational Provenance & Reproducibility Record

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

Computational Provenance & Reproducibility Record Completely Randomized Design (CRD) · 4.0.0 · DOI 10.5281/zenodo.23386730

Computational Provenance & Reproducibility Record

RAISINS · Completely Randomized Design (CRD) Module

This Computational Provenance Record documents the statistical computing environment, software dependencies, computational provenance, and bibliographic references associated with the RAISINS Completely Randomized Design (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 Completely Randomized Design (CRD)
Module Version 4.0.0
DOI 10.5281/zenodo.23386730
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(), anova(), manova(), p.adjust(), shapiro.test(), qt()
agricolae 1.3-7 CRAN LSD.test(), HSD.test(), duncan.test()
lsr 1.0.0 CRAN etaSquared()
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)
One-way linear model stats::lm(y ~ Treatment)
ANOVA table stats::anova(model)
Effect size (Cohen’s f) lsr::etaSquared(model), converted as sqrt(eta2 / (1 - eta2))
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()
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(stats::residuals(model))
Equal treatment variances Median-based Levene (Brown–Forsythe): stats::lm() and stats::anova() on absolute deviations from treatment medians
Unequal-replication CD matrices stats::qt(), replication counts and unrounded model MSE; pairwise formula shown below

4 Default Methods & Parameters

Analysis Step / Parameter Default Method / Value
One-way ANOVA
(lm() + anova())
Model y ~ Treatment (single factor, taken as a factor; one model fitted per response variable)
Sums of squares Sequential (Type I). With a single factor this is identical to Type II and Type III
Error mean square (MSE) Residual SS ÷ residual df from the fitted model; reused by every post-hoc test
Effect size
(lsr::etaSquared())
Treatment effect size Cohen's f, computed from η² as sqrt(eta2 / (1 - eta2))
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 α)
Rounding 2 decimal places default (user-adjustable digit control, 1–10)
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 one-way model; alpha = α
Grouping display Letters 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) for balanced replication. With unequal replication, the main summary reports “-”; Individual ANOVA provides sqrt(MSE/n_i) and the count for each treatment.
SED sqrt(2 × MSE / r) (balanced replication only)
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, endpoint adjustment and radians as described below.
MANOVA
(multi-response mode)
Test statistic Pillai's trace (the stats::manova() default), tidied with broom::tidy()
Requirement At least two finite numeric responses; residual df must be at least the number of responses, with nonzero residual variation and full residual column rank.

5 Transformation Rules

Apply the selected transformation to the entire response variable across all treatments and replications. 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 replications. 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 Replace 0 by 1/(4N) and 1 by 1 - 1/(4N) before transforming Existing convention retained; N is the number of observation rows, 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 or treatment groups independently.

6 Assumptions Tables

Checks use the response scale fitted by ANOVA, including transformations. 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
Residual normality Shapiro–Wilk on residuals of lm(response ~ treatment); 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): one-way ANOVA of abs(y - median(y within treatment)); response, n, F, p-value and finding A p-value below alpha flags unequal-variance concerns. 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. 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.
Table presentation Centre PDF headings and Word headings/cell values; preserve response identifiers, continued headings and notes Main Word tables use compact vertical spacing with automatic row height. HTML markup is written directly into the report, including during interactive R/RStudio use.

Any observations excluded by the diagnostic helper are counted and disclosed in notes. Investigate those exclusions; do not selectively remove observations to obtain a desired test result. Residual Q–Q and residual-versus-fitted plots support interpretation but do not certify normality, variance equality or independence.

7 Unequal-Replication CD Matrices

Output Calculation or behaviour
Treatment precision in Individual ANOVA Show each treatment’s replication count n_i and pooled SE(mean_i) = sqrt(MSE/n_i). A common SE(m)/SE(d) is not reported for unequal replication.
Pairwise CD matrices Provide separate symmetric matrices at 5% and 1% when treatment replication counts differ.
Formula CD(i,j) = qt(1 - alpha/2, error_df) * sqrt(MSE * (1/n_i + 1/n_j)).
Scale and precision Use unrounded model MSE and error df on the ANOVA response scale. Rows and columns identify treatments; the diagonal is not applicable.
Multiple comparisons These matrices are explicitly unadjusted Fisher LSD/CD. They do not replace adjusted LSD results or Tukey/Duncan grouping decisions.
Availability Individual ANOVA and its report/Excel export paths; pairwise calculations are limited to 80 treatments. Equal replication uses the common CD instead.

8 R Code for Key Analytical Steps

The code blocks below illustrate the core model and comparison calculations using PlantGrowth (built into the datasets package): a balanced completely randomized experiment with one factor group (control plus two treatments), 10 replicates per treatment, and dried plant weight as the response.

8.1 One-Way ANOVA and Effect Size

data(PlantGrowth)
d <- PlantGrowth                                 # weight ~ group, 3 treatments x 10 reps, balanced

treatment <- factor(d$group)                     # single treatment factor
y         <- d$weight                            # response variable

# One-way linear model and ANOVA table (mirrors the module; one model per response)
model  <- lm(y ~ treatment)
result <- anova(model)
result                                           # F = 4.85, p = 0.0159

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

# Cohen's f effect size, derived from eta-squared
eta2 <- lsr::etaSquared(model)[1, 1]             # 0.2641
sqrt(eta2 / (1 - eta2))                          # 0.5991

8.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 one-way model; grouping letters ordered with mixedsort.
out <- agricolae::LSD.test(y, treatment, DFerror = dferr, MSerror = MSE,
                           alpha = alpha, p.adj = "none", group = TRUE)

out$groups[gtools::mixedsort(rownames(out$groups)), ]
out$statistics                                   # MSerror, Df, Mean, CV, t.value, LSD (= CD)

# Grouping letters are printed only when the treatment effect is significant:
if (result[1, 5] > alpha) out$groups[, 2] <- ""

# 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, 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 = replications per treatment)
r   <- out$means[1, 3]                           # 10
SEM <- sqrt(MSE / r)                             # 0.1971
SED <- sqrt(2 * MSE / r)                         # 0.2788

8.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 replications before fitting the model and rerun both checks. The valid PlantGrowth example below produces the two test tables; the app also reports unavailable tests and reasons for insufficient data or variation.

data(PlantGrowth)
assumptions_data <- data.frame(
  Treatment = factor(PlantGrowth$group),
  response = PlantGrowth$weight
)
alpha <- 0.05
assumptions_model <- lm(response ~ Treatment, data = assumptions_data)

# Residual normality: Shapiro-Wilk on model residuals, not raw responses.
normality <- shapiro.test(residuals(assumptions_model))
normality_table <- data.frame(
  Response = "weight", n = nrow(assumptions_data),
  W = unname(normality$statistic), p_value = normality$p.value,
  Finding = if (normality$p.value < alpha) "Review normality"
            else "No issue detected"
)
normality_table

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

The app requires 3–5000 residuals with non-negligible variation for Shapiro–Wilk. A Brown–Forsythe test with insufficient deviation variation is marked unavailable. A larger p-value does not prove that an assumption holds; independence must be assessed from the experimental design.

8.4 Unequal Replication: Treatment Precision and Pairwise CD Matrices

For this numerical demonstration only, the first PlantGrowth row is omitted to create treatment counts of 9, 10 and 10. This is not a data-cleaning recommendation: real analyses should retain the observations specified by the study. MSE and error df come from the model fitted to this unequal dataset.

data(PlantGrowth)
unequal_data <- data.frame(
  Treatment = factor(PlantGrowth$group[-1]),
  response = PlantGrowth$weight[-1]
)
unequal_model <- lm(response ~ Treatment, data = unequal_data)
unequal_anova <- anova(unequal_model)
unequal_mse <- unequal_anova$`Mean Sq`[2]
unequal_dfe <- df.residual(unequal_model)

n_i <- table(unequal_data$Treatment)
n_i <- n_i[gtools::mixedsort(names(n_i))]
treatment_precision <- data.frame(
  Treatment = names(n_i),
  Replications = as.integer(n_i),
  SE_mean = sqrt(unequal_mse / as.numeric(n_i))
)
treatment_precision

# Each pair uses its own two replication counts and the pooled model MSE.
pairwise_cd <- function(alpha) {
  sed <- sqrt(unequal_mse *
                outer(1 / as.numeric(n_i), 1 / as.numeric(n_i), "+"))
  cd <- qt(1 - alpha / 2, df = unequal_dfe) * sed
  dimnames(cd) <- list(names(n_i), names(n_i))
  diag(cd) <- NA_real_  # A treatment is not compared with itself.
  cd
}
CD_5_percent <- pairwise_cd(0.05)
CD_1_percent <- pairwise_cd(0.01)

# Round only for display; retain unrounded values for calculations.
round(CD_5_percent, 3)
round(CD_1_percent, 3)

These are unadjusted Fisher LSD/CD matrices on the ANOVA response scale, separate from adjusted LSD or Tukey/Duncan grouping decisions. The app limits pairwise calculations to 80 treatments and reports a common CD for equal replication.

8.5 MANOVA Across Multiple Responses (multi-response mode)

# Numerical example: iris has 3 groups and 4 response variables.
# This is not evidence of a randomised experiment. The app validates residual
# degrees of freedom, residual variation and residual rank, not treatments > responses.
data(iris)
trt <- factor(iris$Species)
Y   <- as.matrix(iris[, 1:4])

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

Explore the entire Completely Randomized Design (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.

9 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.

10 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. https://doi.org/10.32614/CRAN.package.agricolae

Navarro, D. J. (2015). Learning Statistics with R: A Tutorial for Psychology Students and Other Beginners. University of New South Wales. (lsr package). https://doi.org/10.32614/CRAN.package.lsr

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

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

Warnes, G. R., Bolker, B., & Lumley, T. (2023). gtools: Various R Programming Tools. 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. https://doi.org/10.32614/CRAN.package.dplyr

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

Feedback & Discussion