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",
  ...
)

Arguments

combined

list, output from combine_sources function

toplot

vector, which parameters to plot? Options are similar to summary_stat:

  • "p": plots all proportions (default)

  • "global": plots overall proportions

  • "fac1": plots factor 1 proportions

  • "fac2": plots factor 2 proportions

  • "epsilon": plots multiplicative error terms

  • "sd": plots random effect SD terms

levels

vector if toplot="fac1" or toplot="fac2", which level(s) to plot? Plots all levels if level=NULL (default). Specify levels as a vector, e.g. in wolves ex, levels=1 to plot Region 1, levels=c(1,2) to plot Regions 1 and 2.

groupby

character, group by "factor" or "source"? I.e. in wolves example, group proportions by Region 1, Region 2, Region 3 (groupby="factor") vs. Deer, Marine Mammals, Salmon (groupby="source"). Currently only "factor" is implemented.

savepdf

TRUE/FALSE, save plot as .pdf file (in working directory)?

filename

character, file name to save results as (.pdf will be appended automatically)

...

additional arguments to pass to bayesplot::mcmc_intervals. For example:

  • prob: sets inner (thick) interval (default = 50%)

  • prob_outer: sets outer (thin) interval (default = 90%)

  • point_est: what point estimate to use (dot), default = "median", can also use "mean" or "none"

See also

Examples

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) }