ObtainingDIC | R Documentation |
This function calculates the loglikelihood of the dirichlet for the BPBM model. Then, it calculates the loglikelihood with the parameters of each iteration of the MCMC chains and introduces the values in a vector called vectorD. DIC=(1/2)*var(vectorD)+mean(VectorD)
ObtainingDIC(cadenas, MatrizPBmodelo, E, Tt, especiemodi)
cadenas |
Matrix with the iterations (in rows) of all the Markov Chains obtained in th estimation. It is the output of "StudyingParam" adding "$AllChainsJoined". | |||||||||
MatrizPBmodelo |
Matrix with the covariates of the model. In an example with two SPBal and three time points, the covariates are written in the following order:
| |||||||||
E |
Number f bacteria in the dataset. | |||||||||
Tt |
Number of time points available | |||||||||
especiemodi |
Matrix that contains at row i the bacterial taxa of bacteria i at time points t=2,..., |
Returns a data.frame with the DIC value (using the rule, pD = var/2).
Creus-MartÃ, I., Moya, A., Santonja, F. J. (2022). Bayesian hierarchical compositional models for analysing longitudinal abundance data from microbiome studies. Complexity, 2022.
set.seed(314)
especie=t(gtools::rdirichlet(n=2, c(1,2,3)))
E=3
Tt=2
MatrizPBmodelo=rbind(c(1,1),c(-0.3,0.4),c(0.3,0.5))
set.seed(314)
est=Estimating_BPBM(especie,
Tt,
E,
MatrizPBmodelo,
nn.chain=3,
nn.burnin=1000,
nn.sample=5000,
nn.thin=10)
SumFinal=StudyingParam(est$R2jagsOutput$BUGSoutput$summary ,est$SamplesAllChains)
cadenas=SumFinal$AllChainsJoined
especiemodi=especie[,-1]
ObtainingDIC(cadenas,MatrizPBmodelo,E,Tt,especiemodi)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.