Skip to contents

This master function calibrates MetaRVM model parameters using one of several available optimization methods.

Usage

calibrate_metaRVM(
  config,
  params_to_infer,
  ground_truth,
  method,
  settings = list()
)

Arguments

config

A MetaRVMConfig object or a path to a YAML configuration file.

params_to_infer

A named list defining the parameters to be estimated, including their bounds and starting values.

ground_truth

A data.table containing observational data.

method

The optimization method to use: "optim" or "DEoptim".

settings

A list of settings for the chosen optimization method.

Value

The results from the chosen optimization function.

Examples

if (FALSE) { # \dontrun{
# This is a conceptual example.
# You would need a valid config object and ground truth data.

# 1. Load or create a configuration object
config <- MetaRVMConfig$new("path/to/your/config.yaml")

# 2. Define ground truth data (example structure)
ground_truth <- data.table(
  date = as.Date("2023-01-10"),
  age = "18+",
  disease_state = "I_symp",
  value = 150
)

# 3. Define parameters to infer with bounds and start values
params_to_infer <- list(
  ts = list(lower = 0.1, upper = 0.9, start = 0.5),
  pea = list(lower = 0.2, upper = 0.8, start = 0.4)
)

# 4. Calibrate using the 'optim' method
optim_results <- calibrate_metaRVM(
  config = config,
  params_to_infer = params_to_infer,
  ground_truth = ground_truth,
  method = "optim",
  settings = list(method = "L-BFGS-B", control = list(maxit = 100))
)
print(optim_results)

# 5. Calibrate using the 'DEoptim' method
deoptim_results <- calibrate_metaRVM(
  config = config,
  params_to_infer = params_to_infer,
  ground_truth = ground_truth,
  method = "DEoptim",
  settings = list(itermax = 50)
)
print(deoptim_results)
} # }