The perturbation of two compositional vectors v and y is given (up to compositional equivalence) by the elementwise product v * y.

perturb(x, y, ...)

# S3 method for matrix
perturb(x, y, margin, norm = "close")

# S3 method for otu_table
perturb(x, y, norm = "close")

# S3 method for phyloseq
perturb(x, y, norm = "close")

# S3 method for mc_bias_fit
perturb(x, y)



An abundance matrix or phyloseq object containing one


A numeric vector with which to perturb the observations in x


Matrix margin that corresponds to observations (samples); 1 for rows, 2 for columns


String specifying how to normalize the perturbed observations; see Details.


Let w = v * y, where v is a row or column of x. The normalization options specified by the norm argument are

  • "close" Return the compositional closure of w into the simplex, w / sum(w)

  • "keep" Keep the same total abundance as the original vector by returning w * sum(v) / sum(w)

  • "none" Return w without any normalization

If y is named, then the names must agree with the taxa names in x and will be used to reorder y to match the taxa order in x.

See also