Skip to contents

Summarize Function of Allele Frequencies

Usage

summarize_allele_freq_fn(
  mcmc_results,
  fn,
  lower_quantile = 0.025,
  upper_quantile = 0.975,
  merge_chains = TRUE
)

Arguments

mcmc_results

Result of calling run_mcmc()

fn

Function that takes as input a simplex to apply to each allele frequency vector

lower_quantile

The lower quantile of the posterior distribution to return

upper_quantile

The upper quantile of the posterior distribution to return

merge_chains

boolean indicating that all chain results should be merged

Value

Data frame with one row per locus (per chain if merge_chains is FALSE) giving posterior quantiles and mean of fn applied to the sampled allele frequencies.

Details

General function to summarize the posterior distribution of functions of the sampled allele frequencies

Examples

# Posterior summary of the major allele frequency at each locus
major_allele <- summarize_allele_freq_fn(mcmc_results, fn = max)
head(major_allele)
#>   locus post_stat_lower post_stat_med post_stat_upper post_stat_mean
#> 1    L1       0.6080603     0.6602210       0.7098175      0.6597194
#> 2    L2       0.4948026     0.5611394       0.6298014      0.5617760
#> 3    L3       0.2824052     0.3276418       0.3881472      0.3298581
#> 4    L4       0.2856033     0.3261607       0.3893607      0.3310894
#> 5    L5       0.3392146     0.4005094       0.4719954      0.4030284
#> 6    L6       0.6777672     0.7235336       0.7704018      0.7243705