Runs a set of MixMustR models in Stan

run_mixmustr_models(
  model_choices,
  data_streams_list,
  tracer_list,
  sigma_ln_rho,
  ...
)

Arguments

model_choices

A data frame specifying the model configurations to run. Each row should represent a model, with columns indicating the values for sample_tracer, fix_unsampled, hierarchical, and code_path.

data_streams_list

A list containing the input data streams for the model. It should include two data frames named df_stream_1 anddf_stream_2. See details for the expected structure of these.

tracer_list

A named list containing 1–3 data frames of same size, one for the mean signatures, one for their standard deviations, and another one for sample size. The second data frame is mandatory if sample_tracer is TRUE, or if fix_unsampled is FALSE and sample_tracer is FALSE. The third data frame is mandatory if sample_tracer is TRUE. See details for exact structure of these data frames.

sigma_ln_rho

A numeric value or matrix specifying the confidence around the log mixing proportions. If a matrix, it must be of dimensions N X J, with N being the number of observations and J being the number of sources.

...

Additional arguments passed to stan, such as iter, chains, or control.

Value

A list where each element corresponds to a model configuration, containing the run time and model output.

Details

The run_mixmustr_models function automates the process of running multiple MixMustR models based on user-specified configurations. It builds the Stan code for each model, prepares the input data, and runs the models sequentially. The results are returned as a list, with each element containing the run time and model output for a specific configuration. For convenience, MixMustR provides the user with a built-in data frame containing all of the potential allowed models mixmustr_models.

Examples

if (FALSE) { # \dontrun{
library(MixMustR)
# mixmustr_models[6, ] runs quickest
model_fits <- run_mixmustr_models(
  mixmustr_models[6, ], synthetic_df_convergent, tracer_parameters,
  sigma_ln_rho = 0.1, iter = 1e4, warmup = 5e3, chains = 4, cores = 4
)
} # }