amalgam: The 'amalgam' Package

Description Usage Arguments Value Author(s) Examples

View source: R/4-amalgam.R

Description

Welcome to the amalgam package!

The amalgam function finds a useful data-driven amalgamation for the provided compositional data set (where rows are samples and columns are components). It works like this:

1. The genetic algorithm suggests random binary vector solutions.

2. Each binary vector is turned into a weights matrix that defines a rule for amalgamating the composition. See weight.Nto1 and weight.NtoN for the weights matrix types.

3. An objective function determines the goodness of the weights matrix. See objective.keepDist and objective.maxRDA for the objective function types.

4. The genetic algorithm "breeds" and "mutates" the best solutions. Over time, the optimal solution emerges.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
amalgam(
  x,
  n.amalgams = 3,
  maxiter = ncol(x) * 10,
  z = NULL,
  objective = objective.keepDist,
  weights = weight.Nto1,
  asSLR = FALSE,
  shrink = FALSE,
  ...
)

Arguments

x

A matrix. The input data. Rows are samples and columns are components.

n.amalgams

An intger. How many components the amalgamation should have.

maxiter

An integer. How long the genetic algorithm should run.

z

A matrix. The constraining matrix. Optional.

objective

A function. The objective function. See above.

weights

A function. The weights function. See above.

asSLR

A boolean. Toggles whether to turn the amalgams into a set of summed log-ratios (SLRs). See as.slr.

shrink

A boolean. Toggles whether to estimate bin frequencies from the count vectors by James-Stein-type shrinkage.

...

Arguments passed to GA::ga function.

Value

An amalgam S3 object.

Author(s)

Thom Quinn

Examples

1
2
3
4
simData <- randAcomp(5, 10)
result <- amalgam(simData, n.amalgams = 3, objective = objective.keepDist)
print(result)
plot(result)

tpq/amalgam documentation built on March 14, 2020, 10:27 a.m.