LTNLDA: Runs an LTN-LDA Gibbs sampler.

View source: R/Gibbs_Sampler.R

LTNLDAR Documentation

Runs an LTN-LDA Gibbs sampler.

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

LTNLDA(
  ps,
  K,
  C = 5,
  iterations = 1000,
  burnin = 10000,
  thin = 10,
  alpha = 1,
  a1 = 10,
  a2 = 10^4,
  b = 10,
  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.

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.

a1

A double specifying the shape parameter for nodes with less descendants than C. The default value is 10.

a2

A double specifying the shape parameter for nodes with greater than or equal to descendants than C. The default value is 10^4.

b

A double specifying the rate parameter for all nodes. The default value is 10.

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. 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(ps,K)

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