create_abc_sumstat {coala} | R Documentation |
Convert Simulation Results to abc's Summary Statistic Format
Description
This function creates an object compatible with the sumstat
argument of the abc
function from coala's simulation
results. It converts all summary statistics that are in the simulation
results and expects that each of them is a numeric vector.
Use transformation functions to convert none vector-valued statistics
(e.g. sumstat_jsfs
, sumstat_omega
or
sumstat_trees
) into a vector.
Usage
create_abc_sumstat(sim_results, model)
Arguments
sim_results |
The simulation results as returned from
|
model |
The model used for the simulations. |
Value
A data.frame that can be used as sumstat
argument of abc
.
See Also
For generating abc's parameter format:
create_abc_param
Examples
# Using the SFS:
model <- coal_model(10, 1) +
feat_mutation(par_prior("theta", rnorm(1, 5, .5))) +
sumstat_sfs()
sim_results <- simulate(model, nsim = 2)
abc_sumstat <- create_abc_sumstat(sim_results, model)
print(abc_sumstat)
# Using the JSFS and converting it into a vector:
model <- coal_model(c(10, 10), 1) +
feat_mutation(par_prior("theta", rnorm(1, 5, .5))) +
feat_migration(par_prior("m", rnorm(1, .5, .1)), symmetri = TRUE) +
sumstat_jsfs(transformation = function(jsfs) {
c(sum(jsfs[1, ]), sum(jsfs[, 1]), sum(jsfs[-1, -1]))
})
sim_results <- simulate(model, nsim = 2)
abc_sumstat <- create_abc_sumstat(sim_results, model)
print(abc_sumstat)
[Package coala version 0.7.2 Index]