fastrda: Fast Redundancy Analysis (RDA) with HPC C++ Backend

fastrda is a high-performance implementation of Redundancy Analysis (RDA) for R, written in C++ using Armadillo and OpenMP. It is designed for ecological, genomic, and other large multivariate datasets where computational efficiency is critical. fastrda

Features


Installation

CRAN

install.packages("fastrda")

Quick Example

library(fastrda)
library(vegan)

data(mite, mite.env)

# Hellinger transformation (community data: keep the variances, so scale = FALSE)
Y <- decostand(mite, "hellinger")

# Environmental variables
X <- model.matrix(~ SubsDens + WatrCont, mite.env)[, -1]

fit <- fastrda(
  response = Y,
  predictors = X,
  scale = FALSE,
  axes = 2,
  keep_workspace = TRUE
)

summary(fit)

# Extract sample/response scores and biplot scores
sc <- fastrda_scores(fit, display = "both", choices = 1:2)
bp <- biplot_scores(fit, type = "both", scaling = 2)

# Ordination plot
plot(fit)

Permutation test

anova(fit, permutations = 999)

For partial RDA (covariates = Z) the default (scheme = "permute-x") keeps the residualized response fixed, and in every permutation the rows of the predictors are permuted and re-residualized on the covariates. A Freedman-Lane permutation is available with scheme = "freedman-lane"; it is conservative (low power) when the number of responses is large (e.g. p >= 2000). Both are approximate tests.

Direct biplot

biplotrda(fit)

Workspace Modes

keep_workspace is a single on/off switch.

Value Effect
TRUE (default) Keeps Q, QtY, the residualized response Y_res and (partial RDA) the covariate basis Qz and the centered predictors Xc; required by anova(). predict(type = "response") needs it only without newdata, with store_fitted = FALSE and full rank
FALSE Keeps nothing: lowest memory use, no permutation tests

The legacy values "minimal", "compact" and "full" are accepted as synonyms of TRUE, and "none" of FALSE.


Documentation

The package vignette contains a complete workflow and additional examples.

vignette("fastrda")

Browse all available documentation:

help(package = "fastrda")

or

browseVignettes("fastrda")

Performance

Run time depends strongly on the dimensions of the data, the BLAS library and the number of threads. Speed gains are largest for many response variables. Reported timings should always state the comparison method, BLAS, n, p and the number of threads used.


License

GPL (>= 3)