Skip to contents

Summarize COI

Usage

summarize_coi(
  mcmc_results,
  lower_quantile = 0.025,
  upper_quantile = 0.975,
  naive_offset = 2,
  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

naive_offset

Offset used in calculate_naive_coi_offset

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 COI, naive estimates, and the posterior probability that the sample is polyclonal.

Details

Summarize complexity of infection results from MCMC. Returns a dataframe that contains summaries of the posterior distribution of COI for each biological sample, as well as naive estimates of COI.

Examples

coi_summary <- summarize_coi(mcmc_results)
head(coi_summary)
#>   sample_id post_coi_lower post_coi_med post_coi_upper post_coi_mean naive_coi
#> 1        S1              2            2              7         2.791         2
#> 2        S2              4            6             11         6.686         4
#> 3        S3              4            5             10         5.579         4
#> 4        S4              5            7             12         7.163         5
#> 5        S5              8           10             14        10.449         7
#> 6        S6              4            4              7         4.675         4
#>   offset_naive_coi prob_polyclonal
#> 1                2               1
#> 2                4               1
#> 3                4               1
#> 4                5               1
#> 5                6               1
#> 6                4               1