Skip to contents

Simulate data generated according to the assumed model

Usage

simulate_data(
  mean_coi = NULL,
  num_samples,
  epsilon_pos,
  epsilon_neg,
  sample_cois = NULL,
  locus_freq_alphas = NULL,
  allele_freqs = NULL,
  internal_relatedness_alpha = 0,
  internal_relatedness_beta = 1,
  internal_relatedness = NULL,
  missingness = 0
)

Arguments

mean_coi

Mean multiplicity of infection drawn from a Poisson

num_samples

Total number of biological samples to simulate

epsilon_pos

False positive rate, expected number of false positives

epsilon_neg

False negative rate, expected number of false negatives

sample_cois

List of sample COIs to be used instead of simulating

locus_freq_alphas

List of alpha vectors to be used to simulate from a Dirichlet distribution to generate allele frequencies.

allele_freqs

List of allele frequencies to be used instead of simulating allele frequencies

internal_relatedness_alpha

alpha parameter of beta distribution controlling the random relatedness draws for each sample

internal_relatedness_beta

beta parameter of beta distribution controlling the random relatedness draws for each sample

internal_relatedness

List of internal relatedness values to be used instead of simulating

missingness

probability of data being missing

Value

List structured for run_mcmc(), with elements data, sample_ids, loci, and is_missing, along with the simulated truth (allele_freqs, sample_cois, sample_relatedness, true_genotypes) and the input arguments.

Examples

sim <- simulate_data(
  mean_coi = 2,
  num_samples = 10,
  epsilon_pos = 0.01,
  epsilon_neg = 0.1,
  locus_freq_alphas = list(rep(1, 4), rep(1, 4), rep(1, 4))
)
sim$sample_cois
#>  [1] 3 1 2 3 4 1 2 2 2 1
str(sim$data, max.level = 1)
#> List of 3
#>  $ L1:List of 10
#>  $ L2:List of 10
#>  $ L3:List of 10