Run FACTS trial simulations.
run_facts(
  facts_file,
  output_path = tempfile(),
  log_path = output_path,
  n_burn = NULL,
  n_mcmc = NULL,
  n_weeks_files = 10000,
  n_patients_files = 10000,
  n_mcmc_files = 0,
  n_mcmc_thin = NULL,
  flfll_seed = NULL,
  flfll_offset = NULL,
  n_sims,
  ...
)Character, name of a FACTS file.
Usually has a *.facts file extension.
Character, directory path to the files to generate.
Character, path to the log file generated by FLFLL.
Number of burn-in iterations for the MCMC.
Number of MCMC iterations used in inference.
Number of weeks*.csv files to save in output_path.
Number of patients*.csv files to save in
output_path.
Number of mcmc*.csv files to save in
output_path.
Number of thinning iterations for the MCMC.
Positive integer, random number generator seed for FLFLL.
This seed is only used for stochastic preprocessing steps for generating
the *.param files. It is not the random number generator seed
for the actual trial simulations. To set the trial simulation seed,
use the seed argument of run_facts(), run_engine(), or
one of the specific run_engine*() functions.
Integer, offset for the random number generator.
Positive integer, number of simulations per param file.
Named arguments to the appropriate FACTS engine function.
Use get_facts_engine() to identify the appropriate
engine function and then open the help file of that function to read
about the arguments, e.g. ?run_engine_contin.
Character, path to the directory with FACTS output.
run_facts() calls run_flfll() and then run_engine().
For finer control over trial simulation, you can call these
latter two functions individually.
# Can only run if system dependencies are configured:
if (file.exists(Sys.getenv("RFACTS_PATHS"))) {
facts_file <- get_facts_file_example("contin.facts") # example FACTS file
out <- run_facts(
  facts_file,
  n_sims = 4,
  verbose = FALSE
)
# What results files do we have?
head(get_csv_files(out))
# Read all the "patients*.csv" files with `read_patients(out)`.
# For each scenario, we have files named
# patients00001.csv, patients00002.csv, patients00003.csv,
# and patients00004.csv.
read_patients(out)
}