Computational Provenance & Reproducibility Record

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

Computational Provenance & Reproducibility Record Two Sample t-test · 2.0.0 · DOI 10.5281/zenodo.21318199

Computational Provenance & Reproducibility Record

RAISINS · Two Sample t-test Module

This Computational Provenance Record documents the statistical computing environment, software dependencies, computational provenance, and bibliographic references associated with the RAISINS Student’s t-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

Go to the App from here

1 Module Metadata

Parameter Specification
Module Student’s t-test
Module Version 2.0.0
DOI 10.5281/zenodo.21318199
Document Type Computational workflow
Statistical Engine R
R Version 4.6.0
Reproducibility Execution Environment: Posit Connect · GCR · renv-locked

2 Statistical Dependency Manifest

Package Version Repository Core Statistical Functions
nortest 1.0-4 CRAN ad.test()
tseries 0.10-61 CRAN jarque.bera.test()
stats 4.6.0 Base R t.test(), var.test(), shapiro.test(), mean(), var()

3 Statistical Function Registry

Analytical Role Primary Function(s)
Variance homogeneity stats::var.test()
Mean comparison stats::t.test()
Normality testing stats::shapiro.test(), nortest::ad.test(), tseries::jarque.bera.test()
Group means & variances base::mean(), stats::var()

4 Default Methods & Parameters

Analysis Step / Parameter Default Method / Value
Variance
Homogeneity

(var.test())
Test F-test for the ratio of two variances; decision taken at the selected significance level α (default 0.05). Applied for the unpaired design only
Consequence p < α ⇒ variances not homogeneous, Welch's t-test is applied; p ≥ α ⇒ equal-variance Student's t-test is applied
Two-Sample
t-test

(t.test())
Unpaired design (default) Independent-groups test; var.equal is set automatically from the F-test (Student's when equal, Welch's when unequal). Assumes normality within each group, homogeneity of variances, and independence of observations
Paired design (paired = TRUE) Test is computed on the within-pair differences; the variance-homogeneity F-test does not apply and is omitted. Assumes the paired differences are normally distributed and the pairs are independent
Alternative two.sided by default; less and greater optional
Confidence & scope Confidence level = 1 − α (default 95%); the grouping variable must contain exactly two levels; results rounded to 4 decimal places
Normality
Assessment
Tests applied Shapiro-Wilk (shapiro.test(), 3 ≤ n ≤ 5000), Anderson-Darling (nortest::ad.test(), n ≥ 8), and Jarque-Bera (tseries::jarque.bera.test(), n ≥ 3)
Overall decision Majority rule across the available tests; a per-test result is flagged Not Normal at p < α, and a tie is reported as Not Normal

5 R Code for Key Analytical Steps

The code blocks below demonstrate the exact computation behind each reported result using the sleep dataset from the datasets package.

5.1 Variance Homogeneity and Test Selection

data(sleep)
x <- na.omit(sleep$extra[sleep$group == 1])
y <- na.omit(sleep$extra[sleep$group == 2])

alpha <- 0.05
ftest <- var.test(x, y)             # F-test for equality of variances
equal_var <- ftest$p.value >= alpha # TRUE -> Student's ; FALSE -> Welch's
ftest

5.2 Two-Sample t-test

# --- Unpaired / independent groups (default) ---
ttest <- t.test(x, y,
                var.equal   = equal_var,        # from the F-test above
                alternative = "two.sided",      # or "less", "greater"
                conf.level  = 1 - alpha,        # default 95%
                paired      = FALSE)
ttest

# reported quantities
mean(x); mean(y); mean(x) - mean(y)             # group means and difference
ttest$statistic                                 # t value
ttest$parameter                                 # degrees of freedom
ttest$p.value                                   # p-value
ttest$conf.int                                  # confidence interval
if (equal_var) "Student's t-test" else "Welch's t-test"

# --- Paired design (paired = TRUE) ---
# x[i] and y[i] are the two measurements on the same unit; the test uses the
# within-pair differences, so the F-test / equal-variance step does not apply
t.test(x, y,
       alternative = "two.sided",
       conf.level  = 1 - alpha,
       paired      = TRUE)

5.3 Normality Testing

library(nortest)
library(tseries)
z <- na.omit(sleep$extra)
n <- length(z)

if (n >= 3 && n <= 5000) shapiro.test(z)        # Shapiro-Wilk
if (n >= 8)              nortest::ad.test(z)     # Anderson-Darling
if (n >= 3)              tseries::jarque.bera.test(z)  # Jarque-Bera

# Overall: each test flags "Not Normal" when its p-value < alpha;
# the overall verdict follows the majority, with ties resolved to "Not Normal".

Explore the entire Student’s t-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/

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

Trapletti, A., & Hornik, K. (2024). tseries: Time Series Analysis and Computational Finance (R package version 0.10-61). https://doi.org/10.32614/CRAN.package.tseries

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.31). https://github.com/rstudio/rmarkdown

Feedback & Discussion