Last chance! 50% off unlimited learning
Sale ends in
Run statistics on a distance matrix vs a categorical or numeric variable.
distmat_stats(dm, groups, test = "adonis2", seed = 0, permutations = 999)
A data.frame with summary statistics from vegan::permustats()
.
The columns are:
The size of the distance matrix.
The observed statistic. For mrpp, this is the overall weighted mean of group mean distances.
The difference of observed statistic and mean of permutations divided by the standard deviation of permutations (also known as z-values). Evaluated from permuted values without observed statistic.
Probability calculated by test
.
R commands for reproducing the results are in $code
.
A dist
-class distance matrix, as returned from
bdiv_distmat()
or stats::dist()
. Required.
A named vector of grouping values. The names should
correspond to attr(dm, 'Labels')
. Values can be either
categorical or numeric. Required.
Permutational test for accessing significance. Options are:
"adonis2"
- Permutational MANOVA; vegan::adonis2()
.
"mrpp"
- Multiple response permutation procedure; vegan::mrpp()
.
"none"
- Don't run any statistics.
Abbreviations are allowed. Default: "adonis2"
Random seed for permutations. Must be a non-negative integer.
Default: 0
Number of random permutations to use.
Default: 999
Other beta_diversity:
bdiv_boxplot()
,
bdiv_clusters()
,
bdiv_corrplot()
,
bdiv_heatmap()
,
bdiv_ord_plot()
,
bdiv_ord_table()
,
bdiv_stats()
,
bdiv_table()
Other stats_tables:
adiv_stats()
,
bdiv_stats()
,
stats_table()
,
taxa_stats()
library(rbiom)
hmp10 <- hmp50$clone()
hmp10$counts <- hmp10$counts[,1:10]
dm <- bdiv_distmat(hmp10, 'unifrac')
distmat_stats(dm, groups = pull(hmp10, 'Body Site'))
distmat_stats(dm, groups = pull(hmp10, 'Age'))
# See the R code used to calculate these statistics:
stats <- distmat_stats(dm, groups = pull(hmp10, 'Age'))
stats$code
Run the code above in your browser using DataLab