block_LTNLDA: Runs a Block LTN-LDA Gibbs sampler. Encodes block g-wishart...

View source: R/Gibbs_Sampler_Cov.R

block_LTNLDAR Documentation

Runs a Block LTN-LDA Gibbs sampler. Encodes block g-wishart priors.

Description

This function takes a phyloseq object and the modelled number of subcommunities as inputs. It runs a collapsed blocked Gibbs sampler for LTNLDA, and returns a list containing posterior mean estimates for some parameters, Markov Chains for all meaningful parameters, and the phyloseq object. For a detailed example see the vignette "LTN-LDA".

Usage

block_LTNLDA(
  ps,
  K,
  C = 5,
  iterations = 1000,
  burnin = 10000,
  thin = 10,
  alpha = 1,
  a_L = 100,
  b_L = 200,
  a_U = 10^4,
  b_U = 10,
  g_prior = 1/4,
  Lambda = NULL
)

Arguments

ps

A phyloseq object containing an otu_table() and a phy_tree() with an edge matrix. That is, otu_table(ps) and phy_tree(ps)$edge both exist. Further, the otu_table(ps) should have taxa corresponding to rows adn samples corresponding to columns.

K

An integer specifying the number of modeled subcommunities.

C

An integer specifying the threshold controlling cross-sample heterogeneity. The default value is 5. Using the default value may result in unreliable inference.

iterations

The number of iterations to record. Default value is 1000.

burnin

The number of burnin iterations to run before recording values. The default value is 10000.

thin

The amount by which we thin the chain. A value of X means that 1 every X values is recorded after the burnin. The default value is 10.

alpha

A double specifying the prior on the subcommunity-sample proportions. The default value is 1.

a_L

A double such that the degrees of freedom for the G-Wishart prior for the lower precision matrix is a_L+p_L+2. The default value is 100.

b_L

A double such that the scale matrix for the G-Wishart prior for the lower precision matrix is b_L*diag(p_L. The default value is 200.

a_U

A double controlling the scale parameter in the inverse-Gamma distribution for the upper covariance values. The default value is 10^4.

b_U

A double controlling the rate parameter in the inverse-Gamma distribution for the upper covariance values. The default value is 10

g_prior

A double specifying the prior probability that there is an edge between two nodes in the lower covariance matrix. The default value is 1/4.

Lambda

A matrix specifying a covariance prior for the mu_k. The default value is diag(V) where V is the number of leaves.

Value

A list with 8 entries. Mean_Post_Phi_d contains the posterior mean estimate for the subcommunity-sample distributions phi_d. Mean_Post_Beta_kd contains the posterior mean estimate for the sample and subcommunity specific multinomial distributions beta_k,d. Mean_Post_Beta_k contains the posterior mean estimates for the average subcommunity multinomial distributions beta_k. Mean_Post_G_L contains the posterior mean of the edge matrix denoting the probability edges are conditionally dependent for each subcomunity. Chain_Phi contains the Markov Chains for the phi_d. Chain_Psi contains the Markov Chains for the psi_p,d,k. Chain_Mu contains the Markov Chains for the mu_k. Chain_Sigma contains the Markov Chains for the Sigma_k. phyloseq contains the phyloseq object the Gibbs sampler ran on.

References

ADD PAPER INFORMATION ONCE WE KNOW IT

Examples

data("ps",package = "LTNLDA")
K = 2
model = LTNLDA_cov(ps,K)

PatrickLeBlanc/LTNLDA documentation built on May 22, 2022, 12:49 p.m.