Skip to contents

One function for all taxonomic feature statistical tests.

Usage

test_taxa(
  data.obj,
  test.type = c("difference", "trend", "volatility", "association"),
  subject.var = NULL,
  time.var = NULL,
  group.var = NULL,
  adj.vars = NULL,
  time.points = NULL,
  feature.level = "original",
  feature.dat.type = c("count", "proportion", "other"),
  prev.filter = 0.1,
  abund.filter = 1e-04,
  feature.mt.method = c("fdr", "bonferroni", "none"),
  feature.sig.level = 0.05,
  ...
)

Arguments

data.obj

A MicrobiomeStat data object containing feature.tab, meta.dat, and optionally feature.ann, tree, and feature.agg.list.

test.type

Type of test: - "difference": Test for group differences (cross-sectional or paired) - "trend": Test for temporal trends (longitudinal) - "volatility": Test for temporal instability (longitudinal) - "association": Test for associations with continuous variables

subject.var

Character. Name of the subject/sample ID variable in meta.dat. Required for longitudinal and paired designs.

time.var

Character. Name of the time variable in meta.dat. NULL for cross-sectional studies.

group.var

Character. Name of the grouping variable (e.g., treatment, condition).

adj.vars

Character vector. Names of adjustment/covariate variables.

time.points

Time point specification. Can be: - NULL: use all available time points (auto-detect design) - Single value: cross-sectional at that time point - Vector of 2: paired design (baseline, followup) - Vector of >2: longitudinal with specific time points - List: list(baseline = "T0", followup = c("T1", "T2"))

feature.level

Character vector. Taxonomic level(s) for aggregation. Options include column names from feature.ann or "original" for no aggregation.

feature.dat.type

Data type: "count", "proportion", or "other".

prev.filter

Numeric. Minimum prevalence threshold (0-1) for filtering.

abund.filter

Numeric. Minimum abundance threshold for filtering.

feature.mt.method

Multiple testing correction: "fdr", "bonferroni", or "none".

feature.sig.level

Significance threshold (default 0.05).

...

Additional arguments passed to the underlying function.

Value

A list containing statistical results (p-values, coefficients, etc.).

Examples

if (FALSE) { # \dontrun{
data(peerj32.obj)

# Cross-sectional group comparison
test_taxa(peerj32.obj, "difference",
          group.var = "group",
          feature.level = "Genus")

# Longitudinal trend test
test_taxa(peerj32.obj, "trend",
          subject.var = "subject",
          time.var = "time",
          group.var = "group",
          feature.level = "Genus")
} # }