Compute statistical significance of alpha diversity between groups
Source:R/alpha_significance.R
compute_alpha_significance.RdRuns global (Kruskal-Wallis or one-way ANOVA) and pairwise (Wilcoxon or
Tukey HSD) hypothesis tests on each (rank, metric) combination present in
the output of compute_alpha(). Pairwise p-values are adjusted with
p.adjust() and Cohen's d effect sizes are appended.
Arguments
- x
A
"phip_alpha_diversity"list (output ofcompute_alpha()) or a single alpha-diversity data frame.- group_col
Character scalar; name of the grouping column. Inferred from
attr(x, "group_cols")whenNULL(default).- metric
Character vector; subset of metrics to test.
NULL(default) uses all numeric metric columns present in the data.- global_test
One of
"kruskal"(Kruskal-Wallis, default) or"anova"(one-way ANOVA).- pairwise_test
One of
"wilcoxon"(Wilcoxon rank-sum, default) or"tukey"(Tukey HSD fromaov()).- p_adjust_method
Method passed to
p.adjust(). Default"BH".
Value
A named list of class "phip_alpha_significance" with two tibbles:
$globalOne row per
(rank, metric):rank,metric,statistic,p_value,test.$pairwiseOne row per
(rank, metric, pair):rank,metric,group1,group2,p_raw,p_adj,cohens_d,stars,test.
Attributes: group_col, global_test, pairwise_test,
p_adjust_method, metrics, ranks.
Examples
if (FALSE) { # \dontrun{
alpha <- compute_alpha(phip_obj, group_cols = "group")
sig <- compute_alpha_significance(alpha)
sig$global
sig$pairwise
} # }