MixSIAR icon indicating copy to clipboard operation
MixSIAR copied to clipboard

A posteriori aggregation

Open MattLewisCT opened this issue 6 years ago • 0 comments

Hi Brian, I am modelling diets of individual consumers and would like to follow the a posteriori grouping of foods approach used in the mantis shrimp paper (deVries et al. 2016). As I understand it, this is done using the posterior distributions from the models that incorporated non-grouped food sources. If this is true, am I correct in thinking that the following code (lifted from one of the files associated with the paper) yields the results for the broader groups in two data frames ("post.grass" and "post.coral")?

Get posteriors from best fit model #10 (hardprior, hab, mixsir, sources by habitat, conc dep)

attach.jags(jags.1) post.grass <- data.frame(hard = p.fac1[,1,3]+p.fac1[,1,4]+p.fac1[,1,6], soft = p.fac1[,1,1]+p.fac1[,1,2]+p.fac1[,1,5]) post.coral <- data.frame(hard = p.fac1[,2,3]+p.fac1[,2,4]+p.fac1[,2,6], soft = p.fac1[,2,1]+p.fac1[,2,2]+p.fac1[,2,5])

Given that I have no factor that is analogous to "habitat" and have run my model for individual consumers, would the following code give me the posteriors from my model for grouped foods (categories: "Mar" and "Terr") for each individual consumer?

Post <- data.frame(Mar = p.fac1[, , 1] + p.fac1[, , 2], Terr = p.fac1[, , 3] + p.fac1[, , 4])

Best regards, Matt

MattLewisCT avatar Jun 06 '18 14:06 MattLewisCT