output_JAGS processes the mixing model output, prints and saves (in the working directory):

  • diagnostics

  • summary statistics

  • posterior density plots

  • pairs plot

  • trace/XY plots

output_JAGS(
  jags.1,
  mix,
  source,
  output_options = list(summary_save = TRUE, summary_name = "summary_statistics",
    sup_post = FALSE, plot_post_save_pdf = TRUE, plot_post_name = "posterior_density",
    sup_pairs = FALSE, plot_pairs_save_pdf = TRUE, plot_pairs_name = "pairs_plot", sup_xy
    = TRUE, plot_xy_save_pdf = FALSE, plot_xy_name = "xy_plot", gelman = TRUE, heidel =
    FALSE, geweke = TRUE, diag_save = TRUE, diag_name = "diagnostics", indiv_effect =
    FALSE, plot_post_save_png = FALSE, plot_pairs_save_png = FALSE, plot_xy_save_png =
    FALSE, diag_save_ggmcmc = TRUE)
)

Arguments

jags.1

rjags model object, output from run_model function

mix

output from load_mix_data

source

output from load_source_data

output_options

list containing options for plots and saving:

  • summary_save: Save the summary statistics as a txt file? Default = TRUE

  • summary_name: Summary statistics file name (.txt will be appended). Default = "summary_statistics"

  • sup_post: Suppress posterior density plot output in R? Default = FALSE

  • plot_post_save_pdf: Save posterior density plots as pdfs? Default = TRUE

  • plot_post_name: Posterior plot file name(s) (.pdf/.png will be appended) Default = "posterior_density"

  • sup_pairs: Suppress pairs plot output in R? Default = FALSE

  • plot_pairs_save_pdf: Save pairs plot as pdf? Default = TRUE

  • plot_pairs_name: Pairs plot file name (.pdf/.png will be appended) Default = "pairs_plot"

  • sup_xy: Suppress xy/trace plot output in R? Default = TRUE

  • plot_xy_save_pdf: Save xy/trace plot as pdf? Default = FALSE

  • plot_xy_name: XY/trace plot file name (.pdf/.png will be appended) Default = "xy_plot"

  • gelman: Calculate Gelman-Rubin diagnostic test? Default = TRUE

  • heidel: Calculate Heidelberg-Welch diagnostic test? Default = FALSE

  • geweke: Calculate Geweke diagnostic test? Default = TRUE

  • diag_save: Save the diagnostics as a .txt file? Default = TRUE

  • diag_name: Diagnostics file name (.txt will be appended) Default = "diagnostics"

  • indiv_effect: artifact, set to FALSE

  • plot_post_save_png: Save posterior density plots as pngs? Default = FALSE

  • plot_pairs_save_png: Save pairs plot as png? Default = FALSE

  • plot_xy_save_png: Save xy/trace plot as png? Default = FALSE

  • diag_save_ggmcmc: Save ggmcmc diagnostics as pdf? Default = TRUE

Value

p.both -- only if 2 fixed effects OR 1 fixed + 1 random, otherwise NULL).

p.both holds the MCMC chains for the estimated proportions at the different factor levels. Dimensions = [n.draws, f1.levels, f2.levels, n.sources].

Calculated by combining the ilr offsets from global intercept: ilr.both[,f1,f2,src] = ilr.global[,src] + ilr.fac1[,f1,src] + ilr.fac2[,f2,src] And then transforming from ilr- to proportion-space.