Learn R Programming

MixSIAR (version 3.1.10)

output_JAGS: Process mixing model output from JAGS

Description

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

Usage

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

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?

  • summary_name: Summary statistics file name (.txt will be appended)

  • sup_post: Suppress posterior density plot output in R?

  • plot_post_save_pdf: Save posterior density plots as pdfs?

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

  • sup_pairs: Suppress pairs plot output in R?

  • plot_pairs_save_pdf: Save pairs plot as pdf?

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

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

  • plot_xy_save_pdf: Save xy/trace plot as pdf?

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

  • gelman: Calculate Gelman-Rubin diagnostic test?

  • heidel: Calculate Heidelberg-Welch diagnostic test?

  • geweke: Calculate Geweke diagnostic test?

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

  • diag_name: Diagnostics file name (.txt will be appended)

  • indiv_effect: artifact, set to FALSE

  • plot_post_save_png: Save posterior density plots as pngs?

  • plot_pairs_save_png: Save pairs plot as png?

  • plot_xy_save_png: Save xy/trace plot as png?

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.