adonisplus: Permutational multivariate analysis of variance, plus

View source: R/adonis-custom.R

adonisplusR Documentation

Permutational multivariate analysis of variance, plus

Description

Permutational multivariate analysis of variance, plus

Usage

adonisplus(
  data,
  distmat,
  formula,
  sample_id_var = SampleID,
  rep_meas_var = subject_id,
  shuffle = NULL,
  permutations = 999,
  seed = 42
)

Arguments

data

Data to use in the test.

distmat

Distance matrix, either a matrix or an object of class dist The distance matrix will automatically be filtered and re-arranged to match the rows of data.

formula

Model formula. The LHS (the part to the left of the tilde) must be "distmat". The formula can either be a literal formula or a string that can be converted into a formula.

sample_id_var

Variable in data that defines the sample IDs, i.e. the identifiers that correspond to each item in the distance matrix.

rep_meas_var

Variable in data that indicates the repeated measures in the experiment, typically a subject ID or cage ID.

shuffle

Named character vector that specifies how to carry out restricted permutations for variables in data. Names should correspond to variables in data. Values should be either "between" or "within", meaning that values should be shuffled between or within levels of rep_meas_var. See Details for more info.

permutations

Number of permutations.

seed

Random seed, set just before the initial call to vegan::adonis().

Details

A typical experimental design has subjects in a few groups sampled repeatedly over a few time points. If the variable denoting the group is study_group and the variable denoting the time point is time_point, then the shuffle argument would be c(study_group = "between", time_point = "within"). During the permutation stage, the values of the study group will be shuffled between subjects, preserving the value within each subject. Conversely, the values of the time point will be shuffled only within each subject.

Value

The results from vegan::adonis() in tidy format.


ctanes/miscStats documentation built on Nov. 24, 2024, 1:38 p.m.