Description Usage Arguments Value Examples
Fit the Bayesian Graphical Compositional Regression for comparing two groups of microbiome count data.
1 2 3 |
formula |
a one-sided formula that describes the covariates need to be adjusted. |
data |
a phyloseq object containing the otu table, the covariates and the phylogenetic tree. In the OTU table, taxa are rows. The covariate table must contain a grouping variable named "group", with factor levels 0 and 1. |
PrJAP |
a value between 0 and 1. The prior joint alternative probability used for choosing α. |
sum_PrMAP |
a positive value less than the total number of internal nodes in the phylogenetic tree. The sum of prior marginal alternative probability used for choosing τ. The default value is set to 2, recommended for 100 OTUs. |
threshold |
a positive value controls the accuracy used for the empirical Bayes estimate of τ. |
kappa |
a non-negative value controls the chaining pattern will occur along the phylogenetic tree. The default value 0 introduces an explaning away effect. |
nu |
a vector contains a sequence of the dispersion parameter ν used for numerically computing the marginal likelihood. |
sigma |
a positive value. The standard deviation of the normal prior on the regression coefficient. |
verbose |
logicals. If true, print the number of internal node processed while computing the marginal likelihoods. |
BGCR
returns an object of class "BGCR"
. A "BGCR"
object is a list containing the following components:
tree
- the phylogenetic tree. An object of class "phylo"
containing the phylogenetic information of the OTUs.
PJAP
- the posterior joint alternative probability.
PMAP
- a vector containing the posterior marginal alternative probability at each internal node of the phylogenetic tree, ordered according to the label of the node in the phylogenetic tree. Note that the first half of the vector contains zeros since they represent the leaves of the tree.
PJAP_ind
- the posterior joint alternative probability returned by BCR, similar to PJAP
.
PMAP_ind
- the posterior marginal alternative probabilities returned by BCR, similar to PMAP
.
BF
- a vector containing the Bayes factor comparing the local hypotheses at each internal node. The orders are same as the orders in PMAP
.
alpha
- the value of α used for BGCR.
tau
- the value of τ used for BGCR estimated by the empirical Bayes procedure.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | library(ape)
library(phyloseq)
#create a phyloseq object (https://joey711.github.io/phyloseq/import-data.html).
otumat = matrix(sample(1:100, 100, replace = TRUE), nrow = 10, ncol = 10)
rownames(otumat) <- paste0("OTU", 1:nrow(otumat))
colnames(otumat) <- paste0("Sample", 1:ncol(otumat))
taxmat = matrix(sample(letters, 70, replace = TRUE), nrow = nrow(otumat), ncol = 7)
rownames(taxmat) <- rownames(otumat)
colnames(taxmat) <- c("Domain", "Phylum", "Class", "Order", "Family", "Genus", "Species")
OTU = otu_table(otumat, taxa_are_rows = TRUE)
TAX = tax_table(taxmat)
sampledata = sample_data(data.frame(
group = factor(c(rep(0, 4), rep(1, 6))),
Location = factor(sample(c(0,1), size=nsamples(physeq), replace=TRUE)),
Depth = sample(50:1000, size=nsamples(physeq), replace=TRUE),
row.names=sample_names(physeq),
stringsAsFactors=FALSE
))
random_tree = rtree(ntaxa(physeq), rooted=TRUE, tip.label=taxa_names(physeq))
data = phyloseq(OTU, TAX, sampledata, random_tree)
#run BGCR, first adjusting for no covariate
result <- BGCR(~group, data)
#run BGCR, adjusting for some covariate
result <- BGCR(~group + Location + Depth, data)
plot(x = result)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.