Skip to contents

The PlotGelman_*() functions generate plots visualizing the evolution of the Gelman-Rubin-Brooks shrink factor for different model parameters as the number of iterations increases. These plots help assess whether MCMC chains have converged to a common distribution. Each plot includes: median (solid line) and 97.5th percentile (dashed line) of the shrink factor and a dashed horizontal line at 1.1, representing the common convergence threshold. The primary function for users is PlotGelman(), which internally calls:

  • PlotGelman_Alpha(): Plots shrink factor for the Alpha parameter

  • PlotGelman_Beta(): Plots shrink factor for the Beta parameters

  • PlotGelman_Omega(): Plots shrink factor for the Omega parameter

  • PlotGelman_Rho(): Plots shrink factor for the Rho parameter

Usage

PlotGelman(
  Path_Coda = NULL,
  Alpha = TRUE,
  Beta = TRUE,
  Omega = TRUE,
  Rho = TRUE,
  NOmega = 1000L,
  PlottingAlpha = 0.25,
  EnvFile = ".env",
  ReturnPlots = FALSE
)

PlotGelman_Alpha(CodaObj, PlottingAlpha = 0.25)

PlotGelman_Beta(CodaObj, EnvFile = ".env", PlottingAlpha = 0.25)

PlotGelman_Omega(CodaObj, NOmega = 1000L, PlottingAlpha = 0.25)

PlotGelman_Rho(CodaObj)

Arguments

Path_Coda

Character or mcmc.list. Path to a file containing the coda object, or an mcmc.list object representing MCMC samples.

Alpha, Beta, Omega, Rho

Logical. If TRUE, plots the Gelman-Rubin statistic for the respective model parameters (Alpha, Beta, Omega, or Rho). Default: TRUE for all parameters.

NOmega

Integer. Number of species sampled for the Omega parameter. Default: 1000L.

PlottingAlpha

Numeric. Transparency level (alpha) for plot lines (0 = fully transparent, 1 = fully opaque). Default: 0.25.

EnvFile

Character. Path to the environment file containing paths to data sources. Defaults to .env.

ReturnPlots

Character. Path to the folder where the output plots will be saved.

CodaObj

mcmc.list. An MCMC sample object containing posterior distributions from an Hmsc model.

Author

Ahmed El-Gabbas