Species abundance data can be preprocessed with Hellinger transformation or chord transformation data before PCA analysis. Because the Hellinger distance or chord distance with-without data is equal to \(\sqrt2\sqrt{1-Ochiai\ similarity}\), therefore, the sorting diagram (type 1 scale) of PCA analysis after Hellinger transformation or chord transformation with-without data is internal sample The distance between the squares is the Ochiai distance. \(\sqrt2\sqrt{1-Ochiai\ similarity}\) is a distance measure, which is also suitable for the analysis of species data. The processed data is then used for pca without norm.

b_analyse(otutab, ...)

# S3 method for data.frame
b_analyse(
  otutab,
  norm = TRUE,
  method = c("pca", "nmds"),
  group = NULL,
  dist = "bray",
  ndim = 2,
  scale = FALSE,
  ...
)

Arguments

otutab

an otutab data.frame, samples are columns, taxs are rows.

...

add

norm

should normalized or not? (hellinger)

method

one of "pca","pcoa","ca","dca","nmds","plsda","tsne","umap","lda","all"

group

if needed, give a group vector

dist

if use pcoa or nmds, your can choose a dist method (default: bray) or input a distance matrix.

ndim

how many dimension be kept? (default:2). 3 for b_res_3d()

scale

scale, default: FALSE

Value

b_res object

Examples

data(otutab, package = "pcutils")
b_analyse(otutab, method = "pca") -> b_res
#> four dataframes in a list, 1 is eig, 2 is sample_site, 3 is var, 4 is var contribution
plot(b_res, "Group", metadata)