
Alpha Diversity Volatility Test (Longitudinal)
Source:R/generate_alpha_volatility_test_long.R
generate_alpha_volatility_test_long.RdTests associations between alpha diversity volatility and group variables. Volatility is the mean absolute change between consecutive time points normalized by time difference.
Usage
generate_alpha_volatility_test_long(
data.obj,
alpha.obj = NULL,
alpha.name = c("shannon", "observed_species"),
depth = NULL,
time.var,
subject.var,
group.var,
adj.vars = NULL
)Arguments
- data.obj
A MicrobiomeStat data object, which is a list containing at minimum the following components:
feature.tab: A matrix of feature abundances (taxa/genes as rows, samples as columns)meta.dat: A data frame of sample metadata (samples as rows)
Optional components include:
feature.ann: A matrix/data frame of feature annotations (e.g., taxonomy)tree: A phylogenetic tree object (class "phylo")feature.agg.list: Pre-aggregated feature tables by taxonomy
Data objects can be created using converters like
mStat_convert_phyloseq_to_data_objor importers likemStat_import_qiime2_as_data_obj.- alpha.obj
A list containing pre-calculated alpha diversity indices. If NULL and alpha diversity is needed, it will be calculated automatically. Names should match the alpha.name parameter (e.g., "shannon", "simpson"). See
mStat_calculate_alpha_diversity.- alpha.name
Character vector specifying which alpha diversity indices to analyze. Options include:
"shannon": Shannon diversity index
"simpson": Simpson diversity index
"observed_species": Observed species richness
"chao1": Chao1 richness estimator
"ace": ACE richness estimator
"pielou": Pielou's evenness
- depth
Numeric value or NULL. Rarefaction depth for diversity calculations. If NULL, uses minimum sample depth or no rarefaction.
- time.var
Character string specifying the column name in meta.dat containing the time variable. Required for longitudinal and paired analyses. Should be a factor or character with meaningful time point labels.
- subject.var
Character string specifying the column name in meta.dat that uniquely identifies each subject or sample unit. Required for longitudinal and paired designs to track repeated measurements.
- group.var
Character string specifying the column name in meta.dat containing the grouping variable (e.g., treatment, condition, phenotype). Used for between-group comparisons.
- adj.vars
Character vector specifying column names in meta.dat to be used as covariates for adjustment in statistical models. These variables will be included as fixed effects.
Value
A summary object containing the results of the linear model testing the association between alpha diversity volatility and the group variable.
Examples
if (FALSE) { # \dontrun{
data("subset_T2D.obj")
generate_alpha_volatility_test_long(
data.obj = subset_T2D.obj,
alpha.obj = NULL,
alpha.name = c("shannon","observed_species"),
time.var = "visit_number_num",
subject.var = "subject_id",
group.var = "subject_race",
adj.vars = NULL
)
generate_alpha_volatility_test_long(
data.obj = subset_T2D.obj,
alpha.obj = NULL,
alpha.name = c("shannon","observed_species"),
time.var = "visit_number_num",
subject.var = "subject_id",
group.var = "subject_race",
adj.vars = "subject_gender"
)
} # }