Skip to contents

Generate bootstrapped confidence interval for COI estimates.

Usage

bootstrap_ci(
  data,
  max_coi = 25,
  seq_error = 0.01,
  coi_method = c("variant", "frequency"),
  solution_method = c("discrete", "continuous"),
  use_bins = FALSE,
  bin_size = 20,
  replicates = 100,
  parallel = FALSE,
  ncpus = 8
)

# S3 method for default
bootstrap_ci(
  data,
  max_coi = 25,
  seq_error = 0.01,
  coi_method = c("variant", "frequency"),
  solution_method = c("discrete", "continuous"),
  use_bins = FALSE,
  bin_size = 20,
  replicates = 100,
  parallel = FALSE,
  ncpus = 8
)

# S3 method for sim
bootstrap_ci(
  data,
  max_coi = 25,
  seq_error = 0.01,
  coi_method = c("variant", "frequency"),
  solution_method = c("discrete", "continuous"),
  use_bins = FALSE,
  bin_size = 20,
  replicates = 100,
  parallel = FALSE,
  ncpus = 8
)

Arguments

data

The data for which the COI will be computed.

max_coi

A number indicating the maximum COI to compare the simulated data to.

seq_error

The level of sequencing error that is assumed. If no value is inputted, then we infer the level of sequence error.

coi_method

The method we will use to generate the theoretical relationship. The method is either "variant" or "frequency". The default value is "variant".

solution_method

Whether to estimate discrete or continuous COIs.

use_bins

[Deprecated] This argument is no longer supported; to estimate the COI, all data points are used. Data points are not grouped in bins of changing plaf.

bin_size

[Deprecated] This argument is no longer supported; to estimate the COI, all data points are used. Data points are not grouped in bins of changing plaf.

replicates

The number of bootstrap replicates.

parallel

Whether to parallelize the confidence interval calculation. Note that parallelization only works on non-Windows machines.

ncpus

The number of processes to be used in parallel operation.

Value

A tibble() with columns:

coi

The mean COI.

bias

Bias of the statistic.

std.error

The standard error of the statistic.

conf.low

The lower 95% confidence interval.

conf.high

The upper 95% confidence interval.

Examples

sim_data <- sim_biallelic(coi = 5, plmaf = runif(100, 0, 0.5))
bootstrap_ci(sim_data, solution_method = "continuous")
#> # A tibble: 1 × 6
#>     coi estimates        bias std.error conf.low conf.high
#>   <dbl> <list>          <dbl>     <dbl>    <dbl>     <dbl>
#> 1  3.83 <dbl [100 × 1]> 0.206     0.717     2.84      5.74