This document provides a structured overview of all exported and
internal functions of samOptiPro.
Diagnostics
.barrier_before_block
Temporarily switch nimble buildDir (clear compiled & GC)
.restore_builddir
Restore previous nimble buildDir if it was changed
.sop_detect_nondiff_functions
NA
.sop_supports_derivs
Check if derivatives/HMC are supported for a nimble model
compute_diag_from_mcmc
Build a standard diagnostics table from a
compute_diag_from_mcmc_vect
Compute Diagnostics from MCMC Samples (massively scalable)
Configure and run HMC/NUTS safely (global / subset / auto)
diagnose_model_structure
Diagnose model structure, dependencies, and per-sampler time
(parameter- and family-level)
diagnostics_by_target
Target-level diagnostics (time + optional step-size proxy)
profile_sampler_times
Compile (once) and run a NIMBLE MCMC configured in , with
profile_sampler_times_uncompiled
Uncompiled per-sampler timing (R-level)
proxy_step_sd
Step proxy: sd(diff(chain)) on columns matching a pattern
run_structure_and_hmc_test
Run structural diagnostics and (optional) HMC/NUTS smoke test
summarise_showstoppers
NA
test_strategy
Test and compare MCMC strategies on selected bottleneck nodes
test_strategy_family
Family-based sampler strategy: full HMC if allowed, else surgical on
bottlenecks
test_strategy_family_fast
Fast strategy testing for sampler plans (family-level, with optional
full-model HMC/NUTS)
Misc
.avail_vars
Available variable roots present in a model
.compile_mcmc_with_build
Compile a nimble MCMC for a given build object
Build a configureMCMC with sanitized/expanded monitors
.default_sanitize_roots
Discover default monitors from a nimble model (variable-level)
.derive_sampler_params_auto
NA
.derive_sampler_params_from_conf
NA
.plot_rhat_bar
Save a bar chart of R-hat for selected nodes
.plot_traces
Save trace plots for a set of nodes
.print_monitors
Pretty-print selected monitors (optional)
.sop_cbind_align
Bind two matrices by rows count (truncate to common minimum)
.sop_detect_chain_prefix
Detect chain prefix “chainK.” in column names
.sop_expand_roots_to_nodes
Expand many roots to nodes
.sop_expand_var_nodes
Expand one root to nodes via getVarInfo()
.sop_get_uncompiled_model
Return the R-level (uncompiled) nimble model when given either R or
compiled model
.sop_has_model_api
Heuristic check that an object exposes nimble model API
.sop_is_chol_ok
Cholesky check
.sop_is_model
Is this a nimble model?
.sop_make_propCov_PD
Try to make a symmetric matrix positive definite
(nearPD/shrinkage/jitter)
.sop_sanitize_roots
Sanitize monitor roots (drop numerics & empties)
.sop_split_into_blocks
Correlation-based clustering into compact blocks
.sop_strip_chain_prefix
Strip “chainK.” prefix from column names
as_mcmc_list
Convert an object to mcmc.list
as_mcmc_list_sop
Convert various sample formats to coda::mcmc.list (optionally merging
samples2)
Compute per-parameter and global performance diagnostics from an
MCMC
compute_WAIC
Compute WAIC from coda samples that include logLik[] columns
ensure_monitors_exist
Ensure monitors exist on the model (variable-aware)
identify_bottlenecks_family
Identify bottlenecks by parameter stats::family(medians within
families)
merge_mcmc_samples
Merge res$samples and res$samples2 into a
single mcmc.list
plot_family_ess_bar
Family-level ESS bar plot (harmonised style)
plot_family_rhat_bar
Family-level Rhat bar plot (harmonised style)
plot_mcmc_histograms
Histograms for ESS / CE / AE / Rhat (ggplot2)
Plots
.derive_sampler_targets_fast
NA
enrich_hmc_diag_tbl_for_plots
NA
plot_bottlenecks
Plot MCMC Bottlenecks by Node or Family
plot_bottlenecks_fast
Fast bottleneck plots (samplers-only) for large models
plot_bottlenecks_index
Plot diagnostics for stochastic sampler targets (strict) + all-nodes
panels
plot_convergence_checks
Plot convergence diagnostics (R-hat & traces) with family-level
R-hat bars
plot_convergence_rhat_sampled_fast
Fast convergence plots for R-hat (samplers-only), thresholded
plot_strategies_from_test_result_fast
Plot strategy comparisons from test_strategy_family_fast results
(fast path)
plot_strategies_from_test_result_hmc_fast
@export
Runners
build_conf_with_monitors
Build a fresh MCMC configuration with automatic monitors if
missing
run_baseline_coda
Run baseline et retourne un mcmc.list fusionne (samples +
samples2)
run_baseline_config
Run baseline RW/Slice with robust compile/run
run_hmc_all_nodes
Run HMC/NUTS where possible; fallback samplers for uncovered
nodes
Samplers Utilities
.us_expand_compact_node
Expand a compact node Character scalar, e.g. p[1, 1:3]
into explicit indices (numeric only)
.us_expand_vars_to_nodes
Expand variable roots (e.g. “beta”) to explicit node names using
model metadata
.us_sanitize_monitors
Drop numeric junk & control tokens from monitors
.us_tokenize_monitors
Tokenize a monitors specification into clean symbols
sampler_df
Return a data.frame (name, type, target, scale) from a sampler
container.
sampler_df_from_conf
Convenience: directly return sampler_df from an existing conf.
sampler_env_dump
Long data.frame of sampler env numeric fields
sampler_env_numeric_fields
Numeric scalar fields in the environment of each compiled sampler
function
sampler_functions_from_conf
Build and compile an MCMC from a conf to access samplerFunctions.
sampler_scale
Extract a numeric scale proxy from a sampler object.
sampler_scales_after_run
Extract sampler scales after a short adaptive run.
sampler_scales_from_run
Preferred: read scales from a fresh samplerConf list (pre-run).
sampler_targets
Targets (node names) for each sampler in a MCMC configuration