One function for all alpha diversity statistical tests.
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 in alpha diversity - "trend": Test for temporal trends in alpha diversity - "volatility": Test for temporal instability in alpha diversity - "per_time": Test at each time point separately
- alpha.name
Character vector. Alpha diversity indices to calculate. Options: "shannon", "simpson", "observed_species", "chao1", "ace", "pielou".
- alpha.obj
Optional pre-calculated alpha diversity object.
- depth
Rarefaction depth. NULL for no rarefaction.
- 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"))
- ...
Additional arguments passed to the underlying function.
Examples
if (FALSE) { # \dontrun{
data(peerj32.obj)
# Cross-sectional test
test_alpha(peerj32.obj, "difference",
alpha.name = c("shannon", "simpson"),
group.var = "group")
# Longitudinal trend test
test_alpha(peerj32.obj, "trend",
alpha.name = "shannon",
subject.var = "subject",
time.var = "time",
group.var = "group")
} # }
