Computational Provenance & Reproducibility Record

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

Computational Provenance & Reproducibility Record Diversity Analysis and PERMANOVA · 1.1.0

Computational Provenance & Reproducibility Record

RAISINS · Diversity Analysis Module

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

1 Module Metadata

Parameter Specification
Module Diversity Analysis
Module Version Diversity 1.1.0
Document Type Computational workflow
Statistical Engine R
R Version 4.5.0
Reproducibility Execution Environment: Posit Connect · GCR · renv-locked

2 Statistical Dependency Manifest

Package Version Repository Core Statistical Functions
vegan 2.7-5 CRAN diversity(), specnumber(), vegdist(), decostand(), adonis2(), betadisper(), anosim()
fossil 0.4.0 CRAN chao1()
car 3.1-5 CRAN leveneTest()
FSA 0.10.1 CRAN dunnTest()
stats 4.5.0 Base R aov(), shapiro.test(), kruskal.test(), pairwise.t.test(), anova(), hclust(), dist(), scale()

3 Statistical Function Registry

Analytical Role Primary Function(s)
Alpha diversity indices vegan::diversity(), vegan::specnumber(), fossil::chao1()
Assumption checks stats::shapiro.test(), car::leveneTest()
Alpha Diversity Group Comparisons stats::aov(), stats::kruskal.test()
Post-hoc multiple comparison stats::pairwise.t.test(), FSA::dunnTest()
Community dissimilarity vegan::vegdist(), vegan::decostand()
Multivariate group testing vegan::adonis2()
Dispersion homogeneity vegan::betadisper(), stats::anova()
Similarity testing vegan::anosim()
Clustering / ordination stats::hclust(), stats::dist()

4 Default Methods & Parameters

Analysis Step / Parameter Default Method / Value
Alpha Diversity
Group Comparison
Alpha index comparison across group Selected on the basis of a within-group normality check (Shapiro-Wilk): ANOVA (aov()) when the index is approximately normally distributed; Kruskal-Wallis (kruskal.test()) when it is not
Post-hoc Test ANOVA Pairwise t-tests (pairwise.t.test()), pooled SD (pool.sd = TRUE), BH correction (p.adjust.method = "BH")
Kruskal-Wallis Dunn’s test (FSA::dunnTest()), BH correction (method = "bh")
PERMANOVA
(adonis2())
Homogeneity of dispersion Pre-check via betadisper()
Random seed set.seed(1234)
Distance metric 1. Bray-Curtis (vegdist(method = "bray")); 2.Euclidean (under Hellinger transformation) dist(method = "euclidean"))
Permutations 9999
ANOSIM
(anosim())
Random seed set.seed(1234)
Distance metric Bray-Curtis (vegdist(method = "bray"))
Permutations 9999

5 R Code for Key Analytical Steps

The code blocks below demonstrate the exact computation behind each reported result using the dune dataset from the vegan package. All blocks are illustrative and non-executing (eval = FALSE).

5.1 Alpha Diversity Indices

library(vegan)
library(fossil)
data(dune)
### alpha indexes of site1
richness    <- vegan::specnumber(dune)
shannon     <- vegan::diversity(dune, index = "shannon")
simpson     <- vegan::diversity(dune, index = "simpson")
inv_simpson <- vegan::diversity(dune, index = "invsimpson")
pielou      <- shannon / log(richness)
chao        <- round(fossil::chao1(dune), 0)
abundance   <- sum(dune)
margalef    <- (richness - 1) / log(abundance)
berger      <- max(dune) / sum(dune)

5.2 Alpha Diversity Group Comparison

library(vegan)
library(car)
library(FSA)
data("dune")
data("dune.env")
# compute Shannon for each site (each row)
shannon <- diversity(dune, index = "shannon")
# combine into one dataframe
alpha <- data.frame(
  Site       = rownames(dune),
  Management = dune.env$Management,
  Shannon    = round(shannon, 4)
)
# assumption checks
fit <- aov(alpha$Shannon ~ alpha$Management)
sw  <- shapiro.test(residuals(fit))
lev <- car::leveneTest(alpha$Shannon ~ alpha$Management)
# omnibus test + post-hoc
if (sw$p.value > 0.05 & lev$`Pr(>F)`[1] > 0.05) {
  summary(fit)
  pairwise.t.test(alpha$Shannon, alpha$Management,
                  p.adjust.method = "BH", pool.sd = TRUE)
} else {
  kruskal.test(alpha$Shannon ~ alpha$Management)
  FSA::dunnTest(alpha$Shannon ~ alpha$Management, method = "bh")
}

5.3 PERMANOVA & Beta Diversity Comparison

library(vegan)
data("dune")
data("dune.env")
# step 1: Bray-Curtis distance matrix
dist_bc <- vegdist(dune, method = "bray")
# step 2: PERMANOVA (Bray-Curtis)
set.seed(1234)
perm_bc <- adonis2(dist_bc ~ Management,
                   data         = dune.env,
                   permutations = 9999)
perm_bc
# step 3: dispersion pre-check
bd_bc <- betadisper(dist_bc, dune.env$Management)
anova(bd_bc)
# step 4: PERMANOVA — Hellinger / Euclidean (sensitivity check)
dune_hel <- decostand(dune, method = "hellinger")
dist_hel <- dist(dune_hel, method = "euclidean")
set.seed(1234)
perm_hel <- adonis2(dist_hel ~ Management,
                    data         = dune.env,
                    permutations = 9999)
perm_hel

5.4 ANOSIM

library(vegan)
data("dune")
data("dune.env")
dist_bc <- vegdist(dune, method = "bray")
set.seed(1234)
anosim_res <- anosim(dist_bc, dune.env$Management, permutations = 9999)
anosim_res

Explore the entire Diversity 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/

Oksanen, J., Simpson, G. L., Blanchet, F. G., Kindt, R., Legendre, P., Minchin, P. R., O’Hara, R. B., Solymos, P., Stevens, M. H. H., Szoecs, E., Wagner, H., Bedward, M., Bolker, B., Borcard, D., Carvalho, G., De Caceres, M., Durand, S., Evangelista, H. B. A., Hannigan, G., Hill, M., Lahti, L., Martino, C., Ouellette, M., Ribeiro Cunha, E., Smith, T., Stier, A., Ter Braak, C. J. F., & Weedon, J. (2026). vegan: Community Ecology Package (R package version 2.7-5). https://doi.org/10.32614/CRAN.package.vegan

Vavrek, M. J. (2011). fossil: Palaeoecological and palaeogeographical analysis tools. Palaeontologia Electronica, 14(1), 1T.

Fox, J., & Weisberg, S. (2019). An R Companion to Applied Regression (3rd ed.). Sage.

Ogle, D. H., Doll, J. C., Wheeler, A. P., & Dinno, A. (2026). FSA: Simple Fisheries Stock Assessment Methods (R package version 0.10.1). https://doi.org/10.32614/CRAN.package.FSA

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