Builds underlying Stan code for MixMustR model of choice

build_stancode(
  sample_tracer = FALSE,
  fix_unsampled = FALSE,
  hierarchical = FALSE,
  code_path
)

Arguments

sample_tracer

A logical vector, defaults to FALSE.

fix_unsampled

A logical vector, defaults to FALSE.

hierarchical

A logical vector, defaults to FALSE. Should all observations be treated as independent or should the model include a hierarchical grouping structure?

code_path

A character vector indicating the file path to the

Value

Nothing.

Details

MixMustR currently allows for eight model variants which result from three user-driven binary choices: 1) should the model only ingest the mean sampled-source tracer signatures (equivalent to "residual-only error" structure of MixSIAR; Stock et al. 2018) or should it incorporate their uncertainty based on user-provided mean, variance and sample size information (equivalent to "process error" structure of MixSIAR); 2) should the unsampled-source tracer signatures be fixed at the mean across all sampled sources, or should they rather be estimated based on a prior informed by the mean and variance across the sampled tracer signatures? and 3) should all observations be treated as independent or should the model include a hierarchical grouping structure?

Given these three choices, build_stancode saves a stan code to an output directory of the users' choosing. Nothing is returned.

References

Stock BC, Jackson AL, Ward EJ, Parnell AC, Phillips DL, Semmens BX (2018) Analyzing mixing systems using a new generation of Bayesian tracer mixing models. PeerJ, 6:e5096. doi:10.7717/peerj.5096.

Examples

library(MixMustR)
data(mixmustr_models)

build_stancode(mixmustr_models$sample_tracer[1],
               mixmustr_models$fix_unsampled[1],
               mixmustr_models$hierarchical[1],
               mixmustr_models$code_path[1])
#> Exporting Stan code to stan/sample_tracer_TRUE_fix_unsampled_TRUE_hierarchical_TRUE.stan