Skip to contents

Summarize relatedness

Usage

summarize_relatedness(
  mcmc_results,
  lower_quantile = 0.025,
  upper_quantile = 0.975,
  merge_chains = TRUE
)

Arguments

mcmc_results

Result of calling run_mcmc()

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 sample (per chain if merge_chains is FALSE) giving posterior quantiles and mean of within-host relatedness, computed over draws where COI is greater than 1.

Details

Summarize relatedness results from MCMC. Returns a dataframe that contains summaries of the posterior distribution of relatedness for each biological sample.

Examples

relatedness_summary <- summarize_relatedness(mcmc_results)
head(relatedness_summary)
#>   sample_id post_relatedness_lower post_relatedness_med post_relatedness_upper
#> 1        S1            0.144747331            0.3916445              0.9122511
#> 2        S2            0.464705437            0.7214659              0.8616929
#> 3        S3            0.006071576            0.2132397              0.6406921
#> 4        S4            0.011766434            0.2169558              0.5548596
#> 5        S5            0.016569327            0.2038333              0.4791079
#> 6        S6            0.004581076            0.1649911              0.5103347
#>   post_relatedness_mean
#> 1             0.4691603
#> 2             0.7057506
#> 3             0.2544301
#> 4             0.2488523
#> 5             0.2058361
#> 6             0.1951174