Skip to contents

Runs the Bayesian MCMC engine across all sites to classify patient samples as recrudescence or reinfection. Called automatically by MalReBay, but can also be used directly for a step-by-step workflow.

Usage

classify_infections(
  imported_data,
  mcmc_config = system.file("extdata", "default_mcmc_config.rds", package = "MalReBay"),
  n_workers = 1,
  verbose = TRUE,
  suppress_warnings = TRUE
)

Arguments

imported_data

A list returned by import_data.

mcmc_config

Path to an MCMC configuration Excel file, or a named list of parameters. Defaults to the bundled configuration.

n_workers

Number of parallel workers. Defaults to 1.

verbose

Logical. Print progress messages. Defaults to TRUE.

suppress_warnings

Logical. If TRUE (default), silences the MCMC sampler's own console warnings about divergent transitions, treedepth, and E-BFMI (the "N of M transitions ended with a divergence" messages cmdstanr prints as soon as sampling finishes, independently of verbose). Set to FALSE to see them – e.g. while tuning adapt_delta in mcmc_config for a problematic site. This only affects what gets printed; the same diagnostics are always available afterwards via summarise_results's convergence table.

Value

A named list of raw MCMC results per site, or NULL if no valid results are produced. Pass this to summarise_results.

Examples

if (FALSE) { # \dontrun{
imported <- import_data()
results  <- classify_infections(imported)
} # }