Skip to contents

Manages the global mctable (Monte Carlo nodes reference table) by setting or retrieving its value. The table stores metadata about mcnodes including descriptions, functions, and sensitivity analysis parameters.

Usage

set_mctable(data = NULL)

Arguments

data

(data frame, optional). mctable with at minimum an mcnode column. Other columns auto-filled if absent. If NULL, returns the current table. Default: NULL.

Value

Current or newly set mctable. Columns include: mcnode (required), description, mc_func, from_variable, sample_space, transformation, sensi_variation.

Details

mctable columns are interpreted as follows:

  • mcnode: Name of the Monte Carlo node (required).

  • description: Human-readable description of the node.

  • mc_func: Distribution function used to create stochastic nodes (for example runif, rpert). If missing/NA, node is deterministic.

  • from_variable: Source column name in data when different from mcnode.

  • sample_space: Sampling definition used by mctable_bounds() and mctable_sobol_matrices(). Supported formats include c(...) and named bounds such as min = X, max = Y.

  • transformation: R expression applied using value as placeholder before node creation.

  • sensi_variation: OAT variation expression using value placeholder in eval_module().

Examples

# Get current MC table
current_table <- set_mctable()

# Set new MC table
mct <- data.frame(
  mcnode = c("h_prev", "w_prev"),
  description = c("Herd prevalence", "Within herd prevalence"),
  mc_func = c("runif", "runif")
)
set_mctable(mct)
#> mctable set to mct