ibdEstimate: Pairwise relatedness estimation

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/ibdEstimate.R

Description

Estimate the IBD coefficients (k0, k1, k2) or the condensed identity coefficients (d1, ..., d9) between a pair (or several pairs) of pedigree members, using maximum likelihood methods.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
ibdEstimate(
  x,
  ids = typedMembers(x),
  param = c("kappa", "delta"),
  markers = NULL,
  start = NULL,
  tol = sqrt(.Machine$double.eps),
  beta = 0.5,
  sigma = 0.5,
  contourPlot = FALSE,
  levels = NULL,
  verbose = TRUE
)

Arguments

x

A ped object or a list of such.

ids

Either a vector with ID labels, or a data frame/matrix with two columns, where each row contains the ID labels of two individuals. The entries are coerced to characters, and must match uniquely against the ID labels of x. By default, all pairs of members of x are included.

param

Either "kappa" (default) or "delta"; indicating which set of coefficients should be estimated.

markers

A vector with names or indices of markers attached to x, indicating which markers to include. If NULL (default), all markers are used.

start

A probability vector (i.e., with nonnegative entries and sum 1) of length 3 (if param = "kappa") or 9 (if param = "delta"), indicating the initial value of for the optimisation. By default, start is set to (1/3, 1/3, 1/3) if param = "kappa" and (1/9, ..., 1/9) if param = "delta".

tol, beta, sigma

Control parameters for the optimisation routine; can usually be left untouched.

contourPlot

A logical. If TRUE, contours of the log-likelihood function are plotted overlaying the IBD triangle.

levels

(Only relevant if contourPlot = TRUE.) A numeric vector of levels at which to draw contour lines. If NULL (default), the levels are chosen automatically.

verbose

A logical.

Details

It should be noted that this procedure estimates the realised identity coefficients of each pair, i.e., the actual fractions of the autosomes in each IBD state. These may deviate substantially from the theoretical pedigree coefficients.

Maximum likelihood estimation of relatedness coefficients originates with Thompson (1975). Optimisation of κ is done in the (k0, k2)-plane and restricted to the triangle defined by

k0 >= 0, k2 >= 0, k0 + k2 <= 1

. Optimisation of Δ is done in unit simplex of R^8, using the first 8 coefficients.

The implementation optimises the log-likelihood using a projected gradient descent algorithm, combined with a version of Armijo line search.

Value

An object of class ibdEst, which is basically a dataframe with either 6 columns (if param = "kappa") or 12 columns (if param = "delta"). The first three columns are id1 (label of first individual), id2 (label of second individual) and N (the number of markers with no missing alleles). The remaining columns contain the coefficient estimates.

Author(s)

Magnus Dehli Vigeland

References

See Also

ibdBootstrap()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
### Example 1: Siblings
x = nuclearPed(2)

# Simulate 100 markers
x = markerSim(x, N = 100, alleles = 1:4, seed = 123, verbose = FALSE)

# Estimate kappa (expectation: (0.25, 0.5, 0.25)
ibdEstimate(x, ids = 3:4)

# Plot contours of the log-likelihood function
ibdEstimate(x, ids = 3:4, contourPlot = TRUE)

### Example 2: Full sib mating
y = fullSibMating(1)

# Simulate 200 SNP markers
y = markerSim(y, N = 1000, alleles = 1:10, seed = 123, verbose = FALSE)

# Estimate
ibdEstimate(y, ids = 5:6, param = "delta")

forrel documentation built on March 14, 2021, 1:06 a.m.