simulate.coalmodel {coala}R Documentation

Simulate Data According to a Demographic Model

Description

This function simulates a model created with coal_model. The model can be extended with features, parameters and loci. Read the 'coala-introduction' vignette for detailed instructions on creating and simulating such models.

Usage

## S3 method for class 'coalmodel'
simulate(object, nsim = 1, seed, ..., pars = numeric(0), cores = 1)

Arguments

object

The coalescent model to be simulated

nsim

currently unused

seed

A random seed that is set before simulation.

...

currently unused

pars

Values for parameters specified with par_named or par_range. Should be a named numeric vector.

cores

The number of cores that the independent repetitions from nsim will be distributed on. Must be 1 on Windows, and should also be 1 when using R in a graphical environment (e.g. Rstudio).

Value

A list of summary statistics.

Examples

model <- coal_model(10, 3) +
  feat_mutation(5) +
  sumstat_sfs() +
  sumstat_tajimas_d()
simulate(model, nsim = 2)

model <- coal_model(c(5,10), 20) +
  feat_pop_merge(par_range('tau', 0.01, 5), 2, 1) +
  feat_mutation(par_range('theta', 1, 10)) +
  sumstat_jsfs()
simulate(model, pars=c(tau = 1, theta = 5))

[Package coala version 0.7.2 Index]