R/plot_intervals.R
plot_intervals.Rd
plot_intervals
plots the posterior interval estimates (quantile-based) from the MCMC draws in a MixSIAR model.
Calls bayesplot::mcmc_intervals.
plot_intervals( combined, toplot = "p", levels = NULL, groupby = "factor", savepdf = FALSE, filename = "post_intervals", ... )
combined | list, output from |
---|---|
toplot | vector, which parameters to plot? Options are similar to
|
levels | vector if |
groupby | character, group by "factor" or "source"? I.e. in wolves example, group proportions by Region 1, Region 2, Region 3
( |
savepdf |
|
filename | character, file name to save results as ( |
... | additional arguments to pass to bayesplot::mcmc_intervals. For example:
|
if (FALSE) { # 1. run mantis shrimp example original <- combine_sources(jags.1, mix, source, alpha, groups=list(alphworm="alphworm",brittlestar="brittlestar",clam="clam", crab="crab",fish="fish",snail="snail")) # 2. combine 6 sources into 2 groups of interest (hard-shelled vs. soft-bodied) # 'hard' = 'clam' + 'crab' + 'snail' # group 1 = hard-shelled prey # 'soft' = 'alphworm' + 'brittlestar' + 'fish' # group 2 = soft-bodied prey combined <- combine_sources(jags.1, mix, source, alpha.prior=alpha, groups=list(hard=c("clam","crab","snail"), soft=c("alphworm","brittlestar","fish"))) plot_intervals(combined,toplot="fac1") plot_intervals(original,toplot="fac1") plot_intervals(combined,toplot="fac1",levels=1) plot_intervals(combined,toplot="fac1",levels=2) }