-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to extract posterior data from output_posteriors object? #376
Comments
I am having this same issue. In the output options for my model with one fixed categorical variable (Year) and one continuous variable (Age), I can get plots of proportion by age for each year, but I would like to be able to modify these in ggplot. However, when I extract the code using a similar set of functions as the alligator code, I get the age and proportion plot for all years combined. How would I extract posterior data for each level of my categorical variable? Here is my code to replicate extracting the posteriors for the continuous variable with all levels of my categorical variable combined: R2jags::attach.jags(jags.2) calc_eps <- function(f){ ce=1 n.plot = 200 e <- matrix(rep(0,n.sources*(n.sources-1)),nrow=n.sources,ncol=(n.sources-1)) cross <- array(data=NA,dim=c(n.plot, chain.len, n.sources, n.sources-1)) get_high <- function(x){return(quantile(x,.95))} # 90% CI Cont1.plot <- Cont1.plot*mix$CE_scale + mix$CE_center # transform Cont1.plot (x-axis) back to the original scale |
I have similar data to the alligator example with a continuous variable (mine is weight) but my data is significantly different by location (6 sites). The output settings work to produce the graphs I want, but I need to modify the graphs because they change the color of each prey item by location and the titles are wrong etc.... Anyway, I am not certain what data I need to extract and where.
Ive been following the code for modifying MixSIAR plots,
http://brianstock.github.io/MixSIAR/articles/modify_output.html#set-output-options-to-return-ggplot-objects-1
but it still doesn't have the flexibility I know how to manipulate, so would like to know what to extract from the output_posteriors object created so I can make my own ggplot of the data.
The text was updated successfully, but these errors were encountered: