R/run_ga.R
run_ga.Rd
Runs a simulation-based GA routine of the given model, using the degree of a match between observed and simulated data as a measure of fitness.
run_ga(
model,
functions,
observed,
bounds,
iterations,
sequence_length,
recombination_rate,
mutation_rate = 0,
engine = NULL,
model_args = NULL,
engine_args = NULL,
...
)
Either a slendr model generating function (in which case engine
must
be either "msprime" or "slim", i.e. one of the two of slendr's simulation back ends),
or a path to a custom user-defined SLiM or msprime script (in which case engine
must be "custom").
A named list of summary statistic functions to apply on simulated tree sequences
A named list of observed summary statistics
How many simulation replicates to run?
Amount of sequence to simulate using slendr (in numbers of basepairs)
Recombination rate to use for the simulation
Mutation rate to use for the simulation
Which simulation engine to use? Values "msprime" and "slim" will use one of
the built-in slendr simulation back ends. Which engine will be used is determined
by the nature of the model
. If engine = NULL
, then spatial slendr models will
by default use the "slim" back end, non-spatial models will use the "msprime" back end, and
custom user-defined model scripts will use the "custom" engine. Setting this argument
explicitly will change the back ends (where appropriate). Setting this argument for custom
simulation script has no effect.
Optional (non-prior) arguments for the slendr model generating function. Setting this argument for custom simulation script has no effect.
Optional arguments for the slendr simulation back end. Setting this argument for custom simulation script has no effect.
Additional arguments passed on the ga
function from
the GA package
A list of prior distributions to use for sampling of model parameters
This function internally uses the functionga
from
the R package GA. All function arguments except to data
are passed to the
abc
function, appropriately unpacking the prior sample matrix,
and binding together matrices with observed statistics and simulated statistics
in the format required by the inference function.
This function exists to avoid the need to manually track parameter matrices
and summary statistics as inputs to the abc
function but acts
entirely transparently. A such, all implementation details can be found in the abc
vignette and the manpage which you can access by typing ?abc::abc
.