Learn R Programming

ribd (version 1.1.0)

condensedIdentity: Condensed identity coefficients

Description

Computes the 9 condensed identity coefficients of pairwise relationships in a pedigree. Founders of the pedigree may be inbred; use pedtools::founderInbreeding() to set this up.

Usage

condensedIdentity(x, ids, sparse = NA, verbose = FALSE, checkAnswer = verbose)

Arguments

x

A pedigree in the form of a pedtools::ped object

ids

A character (or coercible to character) containing ID labels of two or more pedigree members.

sparse

A positive integer, indicating the pedigree size limit for using sparse arrays (as implemented by the slam package) instead of ordinary arrays.

verbose

A logical

checkAnswer

A logical. If TRUE, and the identity package is installed, the result is checked against the output of identity::identity.coefs(). This option is ignored if any of the founders are inbred, or if ids has length greater than 2.

Value

If ids has length 2: A vector of length 9, containing the condensed identity coefficients.

If ids has length > 2: A data frame with one row for each pair of individuals, and 11 columns. The first two columns contain the ID labels, and columns 3-11 contain the condensed identity coefficients.

Details

The implementation is a modified version of Karigl's recursive algorithm (1981).

References

G. Karigl (1981). A recursive algorithm for the calculation of identity coefficients Annals of Human Genetics, vol. 45.

See Also

kappa(), condensedIdentityX(), pedtools::founderInbreeding()

Examples

Run this code
# NOT RUN {
# One generation of full sib mating.
# (One of the simplest examples with all 9 coefficients nonzero.)
x = fullSibMating(1)
j1 = condensedIdentity(x, ids = 5:6)

stopifnot(all.equal(j1, c(2, 1,4, 1, 4, 1, 7, 10, 2)/32))

# Recalculate the coefficients when the founders are 100% inbred
founderInbreeding(x, 1:2) = 1
condensedIdentity(x, ids = 5:6)

# }

Run the code above in your browser using DataLab