Learn R Programming

coala (version 0.7.2)

calc_sumstats_from_data: Calculate summary statistics for biological data

Description

This function calculates a model's summary statistic from biological data. The data needs to be provided as a list of segregating sites objects. These objects can be create using the create_segsites function.

Usage

calc_sumstats_from_data(
  model,
  segsites_list = NULL,
  tree_list = NULL,
  trios = NULL,
  ...
)

Arguments

model

The coala model. The summary statistics present in this model will be calculated. The model should fit to the data, in particular regarding the number of loci and haploids.

segsites_list

Either a list of segsites objects, or an object that can be converted using as.segsites. It is possible to specify additional argument for the conversion using the ... argument.

tree_list

Not yet implemented.

trios

If your model is using locus trios, then you can create these by combining individual loci. This is a list that defines which loci are combined to a trio. Each entry should consist of either one or three numbers. For one number, the locus used for calculating the summary statistics is locus in the provided data that corresponds to the number. If three numbers are provided, the locus for calculation is created by combining the corresponding three loci from the given data.

...

Additional arguments that will be passed to as.segsites.

Examples

Run this code
segsites <- create_segsites(matrix(c(1, 0, 0,
                                     1, 1, 0,
                                     0, 0, 1), 3, 3, TRUE),
                            c(.1, .3, .5))
model <- coal_model(3, 1) +
  sumstat_sfs() +
  sumstat_nucleotide_div() +
  sumstat_mcmf()
sumstats <- calc_sumstats_from_data(model, list(segsites))
print(sumstats)

Run the code above in your browser using DataLab