ibdBootstrap: Bootstrap estimation of IBD coefficients

View source: R/ibdBootstrap.R

ibdBootstrapR Documentation

Bootstrap estimation of IBD coefficients

Description

This function produces (parametric or nonparametric) bootstrap estimates of the IBD coefficients between two individuals. Both kappa and delta coefficients are supported (see ibdEstimate()).

Usage

ibdBootstrap(
  x = NULL,
  ids = NULL,
  param = NULL,
  kappa = NULL,
  delta = NULL,
  N,
  method = "parametric",
  freqList = NULL,
  plot = TRUE,
  seed = NULL
)

Arguments

x

A ped object. If method = "parametric", this is only used to extract the allele frequencies, and can be skipped if freqList is provided.

ids

A pair of ID labels.

param

Either NULL (default), "kappa" or "delta". (See below.)

kappa, delta

Probability vectors of length 3 (kappa) or 9 (delta). Exactly one of param, kappa and delta must be non-NULL. If kappa and delta are both NULL, the appropriate set of coefficients is computed as ibdEstimate(x, ids, param).

N

The number of simulations.

method

Either "parametric" (default) or "nonparametric". Abbreviations are allowed. see Details for more information about each method.

freqList

A list of probability vectors: The allele frequencies for each marker.

plot

A logical, only relevant for bootstraps of kappa. If TRUE, the bootstrap estimates are plotted in the IBD triangle.

seed

An integer seed for the random number generator (optional).

Details

The parameter method controls how bootstrap estimates are obtained in each replication.

If method = "parametric", new profiles for two individuals are simulated from the input coefficients, followed by a re-estimation of the coefficients.

If method = "nonparametric", the original markers are sampled with replacement, before the coefficients are re-estimated.

Value

A data frame with N rows containing the bootstrap estimates. The last column (dist) gives the euclidean distance to the original coefficients, viewed as a point in R^3 (kappa) or R^9 (delta).

See Also

ibdEstimate()

Examples


# Frequency list of 15 standard STR markers
freqList = NorwegianFrequencies[1:15]

# Number of bootstrap simulations (increase!)
N = 5

# Bootstrap estimates for kappa of full siblings
boot1 = ibdBootstrap(kappa = c(0.25, .5, .25), N = N, freqList = freqList)
boot1

# Mean deviation
mean(boot1$dist)

# Same, but with the 9 identity coefficients.
delta = c(0, 0, 0, 0, 0, 0, .25, .5, .25)
boot2 = ibdBootstrap(delta = delta, N = N, freqList = freqList)

# Mean deviation
mean(boot2$dist)

#### Non-parametric bootstrap.
# Requires `x` and `ids` to be provided

x = nuclearPed(2)
x = markerSim(x, ids = 3:4, N = 50, alleles = 1:10, seed = 123)

bootNP = ibdBootstrap(x, ids = 3:4, param = "kappa", method = "non", N = N)

# Parametric bootstrap can also be done with this syntax
bootP = ibdBootstrap(x, ids = 3:4, param = "kappa", method = "par", N = N)


forrel documentation built on Nov. 19, 2023, 5:14 p.m.