Learn R Programming

douconca (version 1.2.1)

wrda: Performs a weighted redundancy analysis

Description

wrda is formula-based implementation of weighted redundancy analysis.

Usage

wrda(formula, response, data, weights = rep(1, nrow(data)), verbose = TRUE)

Value

All scores in the dcca object are in scaling "sites" (1): the scaling with Focus on Case distances.

Arguments

formula

one or two-sided formula for the rows (samples) with row predictors in data. The left hand side of the formula is ignored as it is specified in the next argument (response). Specify row covariates (if any ) by adding + Condition(covariate-formula) to formula as in rda. The covariate-formula should not contain a ~ (tilde).

response

matrix or data frame of the abundance data (dimension n x m). Rownames of response, if any, are carried through.

data

matrix or data frame of the row predictors, with rows corresponding to those in response (dimension n x p).

weights

row weights (a vector). If not specified unit weights are used.

verbose

logical for printing a simple summary (default: TRUE)

Details

The algorithm is a modified version of published R-code for weighted redundancy analysis (ter Braak, 2022).

In the current implementation, formula should contain variable names as is, i.e. transformations of variables in the formulas gives an error ('undefined columns selected') when the scores function is applied.

Compared to rda, wrda does not have residual axes, i.e. no SVD or PCA of the residuals is performed.

References

ter Braak C.J.F. and P. Šmilauer (2018). Canoco reference manual and user's guide: software for ordination (version 5.1x). Microcomputer Power, Ithaca, USA, 536 pp.

Oksanen, J., et al. (2022) vegan: Community Ecology Package. R package version 2.6-4. https://CRAN.R-project.org/package=vegan.

See Also

scores.wrda, anova.wrda, print.wrda

Examples

Run this code
data("dune_trait_env")

# rownames are carried forward in results
rownames(dune_trait_env$comm) <- dune_trait_env$comm$Sites
response <- dune_trait_env$comm[, -1]  # must delete "Sites"

w <- rep(1, 20) 
w[1:10] <- 8 
w[17:20] <- 0.5

object <- wrda(formula = ~ A1 + Moist + Mag + Use + Condition(Manure),
               response = response, 
               data = dune_trait_env$envir, 
               weights = w)
object # Proportions equal to those Canoco 5.15

mod_scores <- scores(object, display = "all")
scores(object, which_cor = c("A1", "X_lot"), display = "cor")
anova(object)

Run the code above in your browser using DataLab