sumstat_jsfs {coala}R Documentation

Summary Statistic: Joint Site Frequency Spectrum

Description

The summary statistic calculates the joint site frequency spectrum (JSFS) for multiple populations.

Usage

sumstat_jsfs(
  name = "jsfs",
  populations = c(1, 2),
  per_locus = FALSE,
  transformation = identity
)

Arguments

name

The name of the summary statistic. When simulating a model, the value of the statistics are written to an entry of the returned list with this name. Summary statistic names must be unique in a model.

populations

An integer vector containing the populations for which the JSFS is generated.

per_locus

If TRUE, the JSFS is returned for each locus instead of globally. In this case, the result is a list, where each entry is the JSFS for the corresponding locus.

transformation

An optional function for transforming the results of the statistic. If specified, the results of the transformation are returned instead of the original values.

Value

The JSFS, given as an array. The dimensions correspond to the populations as given in the populations argument.

See Also

To create a demographic model: coal_model

To calculate this statistic from data: calc_sumstats_from_data

Other summary statistics: sumstat_dna(), sumstat_file(), sumstat_four_gamete(), sumstat_ihh(), sumstat_mcmf(), sumstat_nucleotide_div(), sumstat_omega(), sumstat_seg_sites(), sumstat_sfs(), sumstat_tajimas_d(), sumstat_trees()

Examples

model <- coal_model(c(2, 3, 4), 2) +
  feat_mutation(5) +
  feat_migration(1, symmetric = TRUE) +
  sumstat_jsfs("jsfs_12", populations = c(1, 2)) +
  sumstat_jsfs("jsfs_123", populations = c(1, 2, 3))
stats <- simulate(model)
print(stats$jsfs_12)
print(stats$jsfs_123)

[Package coala version 0.7.2 Index]