Plot model convergence of a selected model
Source:R/Mod_Convergence_Plot.R
, R/Mod_Convergence_Alpha.R
, R/Mod_Convergence_Rho.R
Convergence_plots.Rd
The Convergence_Plot()
function generates and saves convergence diagnostics
plots for the rho
, alpha
, omega
, and beta
parameters in an Hmsc
model. These plots help assess whether the MCMC chains have reached
stationarity. It supports parallel processing and can work with models fitted
on HPC environments.
Usage
Convergence_Plot(
Path_Coda = NULL,
Path_Model = NULL,
EnvFile = ".env",
Title = " ",
NOmega = 1000L,
NCores = 8L,
NRC = c(2L, 2L),
Beta_NRC = c(3L, 3L),
SavePlotData = TRUE,
PagePerFile = 20L,
Cols = NULL,
MarginType = "histogram"
)
Convergence_Alpha(
Post = NULL,
Model = NULL,
Title = NULL,
NRC = NULL,
AddFooter = TRUE,
AddTitle = TRUE,
Cols = NULL,
MarginType = "histogram"
)
Convergence_Rho(
Post = NULL,
Model = NULL,
Title = NULL,
Cols = NULL,
MarginType = "histogram"
)
Arguments
- Path_Coda
Character. Path to a saved coda object containing MCMC samples.
- Path_Model
Character. Path to a saved Hmsc model object.
- EnvFile
Character. Path to the environment file containing paths to data sources. Defaults to
.env
.- Title
Character. Title for rho and alpha convergence plots. Default: " "
- NOmega
Integer. Number of species interactions sampled for Omega parameter diagnostics. Default: 1000L
- NCores
Integer. Number of CPU cores to use for parallel processing. Default: 8.
- NRC
Numeric vector. Grid layout (rows×columns) for arranging alpha parameter plots. Default:
c(2, 2)
. IfNULL
, the layout is automatically determined based on the number of alpha levels.- Beta_NRC
Numeric vector. The grid layout (rows×columns) for arranging beta parameter plots. Default:
c(3, 3)
.- SavePlotData
Logical. If
TRUE
(default), saves the plot data as.RData
files.- PagePerFile
Integer. Number of plots per page in the Omega parameter output. Default: 20L.
- Cols
Character vector. MCMC chain colors (optional). Default:
NULL
.- MarginType
Character. The type of marginal plot to add to the main plot. Valid options are "histogram" (default) or "density".
- Post
mcmc.list
or character. Either an MCMC object (mcmc.list
) containing posterior samples, or a file path to a saved coda object.- Model
Hmsc
object or character. Either a fitted Hmsc model object, or a file path to a saved Hmsc model.Logical. If
TRUE
(default), adds a footer with page numbers to each plot.- AddTitle
Logical. If
TRUE
(default), adds the main title (Title
) to the plot.