calc_sumstats_from_data: Calculate summary statistics for biological data

View source: R/sumstat.R

calc_sumstats_from_dataR Documentation

Calculate summary statistics for biological data


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.


  segsites_list = NULL,
  tree_list = NULL,
  trios = NULL,



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.


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.


Not yet implemented.


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.


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() +
sumstats <- calc_sumstats_from_data(model, list(segsites))

coala documentation built on May 29, 2024, 11:14 a.m.