A convenience wrapper for adiv_table() + stats_table().
adiv_stats(
biom,
regr = NULL,
stat.by = NULL,
adiv = "Shannon",
split.by = NULL,
transform = "none",
test = "emmeans",
fit = "gam",
at = NULL,
level = 0.95,
alt = "!=",
mu = 0,
p.adj = "fdr"
)A tibble data.frame with fields from the table below. This tibble
object provides the $code operator to print the R code used to generate
the statistics.
| Field | Description |
| .mean | Estimated marginal mean. See emmeans::emmeans(). |
| .mean.diff | Difference in means. |
| .slope | Trendline slope. See emmeans::emtrends(). |
| .slope.diff | Difference in slopes. |
| .h1 | Alternate hypothesis. |
| .p.val | Probability that null hypothesis is correct. |
| .adj.p | .p.val after adjusting for multiple comparisons. |
| .effect.size | Effect size. See emmeans::eff_size(). |
| .lower | Confidence interval lower bound. |
| .upper | Confidence interval upper bound. |
| .se | Standard error. |
| .n | Number of samples. |
| .df | Degrees of freedom. |
| .stat | Wilcoxon or Kruskal-Wallis rank sum statistic. |
| .t.ratio | .mean / .se |
| .r.sqr | Percent of variation explained by the model. |
| .adj.r | .r.sqr, taking degrees of freedom into account. |
| .aic | Akaike Information Criterion (predictive models). |
| .bic | Bayesian Information Criterion (descriptive models). |
| .loglik | Log-likelihood goodness-of-fit score. |
| .fit.p | P-value for observing this fit by chance. |
An rbiom object, such as from as_rbiom().
Any value accepted by as_rbiom() can also be given here.
Dataset field with the x-axis (independent; predictive)
values. Must be numeric. Default: NULL
Dataset field with the statistical groups. Must be
categorical. Default: NULL
Alpha diversity metric(s) to use. Options are: "OTUs",
"Shannon", "Chao1", "Simpson", and/or
"InvSimpson". Set adiv=".all" to use all metrics.
Multiple/abbreviated values allowed.
Default: "Shannon"
Dataset field(s) that the data should be split by prior to
any calculations. Must be categorical. Default: NULL
Transformation to apply. Options are:
c("none", "rank", "log", "log1p", "sqrt", "percent"). "rank" is
useful for correcting for non-normally distributions before applying
regression statistics. Default: "none"
Method for computing p-values: 'wilcox', 'kruskal',
'emmeans', or 'emtrends'. Default: 'emmeans'
How to fit the trendline. 'lm', 'log', or 'gam'.
Default: 'gam'
Position(s) along the x-axis where the means or slopes should be
evaluated. Default: NULL, which samples 100 evenly spaced positions
and selects the position where the p-value is most significant.
The confidence level for calculating a confidence interval.
Default: 0.95
Alternative hypothesis direction. Options are '!='
(two-sided; not equal to mu), '<' (less than mu), or '>'
(greater than mu). Default: '!='
Reference value to test against. Default: 0
Method to use for multiple comparisons adjustment of
p-values. Run p.adjust.methods for a list of available
options. Default: "fdr"
Other alpha_diversity:
adiv_boxplot(),
adiv_corrplot(),
adiv_table()
Other stats_tables:
bdiv_stats(),
distmat_stats(),
stats_table(),
taxa_stats()
library(rbiom)
biom <- rarefy(hmp50)
adiv_stats(biom, stat.by = "Sex")[,1:6]
adiv_stats(biom, stat.by = "Sex", split.by = "Body Site")[,1:6]
adiv_stats(biom, stat.by = "Body Site", test = "kruskal")
Run the code above in your browser using DataLab