sim_plnm  R Documentation 
Generate microbial absolute abundances using the Poisson lognormal (PLN) model based on the mechanism described in the LDM paper (supplementary text S2).
sim_plnm(abn_table, taxa_are_rows = TRUE, prv_cut = 0.1, n, lib_mean, disp)
abn_table 
the input microbial count table. It is used to obtain
the estimated variancecovariance matrix, can be in either 
taxa_are_rows 
logical. TRUE if the input dataset has rows represent taxa. Default is TRUE. 
prv_cut 
a numerical fraction between 0 and 1. Taxa with prevalences
less than 
n 
numeric. The desired sample size for the simulated data. 
lib_mean 
numeric. Mean of the library size. Library sizes are
generated from the negative binomial distribution with parameters

disp 
numeric. The dispersion parameter for the library size.
For details, see 
The PLN model relates the abundance vector with a Gaussian latent vector. Because of the presence of a latent layer, the PLN model displays a larger variance than the Poisson model (overdispersion). Also, the covariance (correlation) between abundances has the same sign as the covariance (correlation) between the corresponding latent variables. This property gives enormous flexibility in modeling the variancecovariance structure of microbial abundances since it is easy to specify different variancecovariance matrices in the multivariate Gaussian distribution.
However, instead of manually specifying the variancecovariance matrix, we choose to estimate the variancecovariance matrix from a real dataset, which will make the simulated data more resemble real data.
a matrix
of microbial absolute abundances, where taxa are in
rows and samples are in columns.
Huang Lin
hu2020testingANCOMBC
library(ANCOMBC) data(QMP) abn_data = sim_plnm(abn_table = QMP, taxa_are_rows = FALSE, prv_cut = 0.05, n = 100, lib_mean = 1e8, disp = 0.5) rownames(abn_data) = paste0("Taxon", seq_len(nrow(abn_data))) colnames(abn_data) = paste0("Sample", seq_len(ncol(abn_data)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.