Learn R Programming

ribd (version 1.7.1)

kin2deg: Degree of relationship

Description

Converts a vector of kinship coefficients to "degrees of relationship", as used by some software for relatedness inference (e.g. KING).

Usage

kin2deg(kin, unrelated = Inf)

Value

An integer vector of the same length as kin.

Arguments

kin

A vector of kinship coefficients, i.e., numbers in [0, 1].

unrelated

The conversion of unrelated individuals (kin = 0). Mathematically this corresponds to degree = Inf, but in some situations degree = NA or something else might be preferable.

Details

The implementation uses the conversion formula $$deg = round(-log2(kin) - 1).$$ The first degrees correspond to the following approximate kinship ranges:

  • [0.354, 1]: 0th degree (MZ twins or duplicates)

  • [0.177, 0.354): 1st degree (parent-offspring, full siblings)

  • [0.0884, 0.177): 2nd degree (half sibs, grandparent-grandchild, avuncular)

  • [0.0442, 0.0884) 3rd degree (half-avuncular, first cousins, great-grandparent etc)

References

KING manual with thresholds for relationship degrees: https://www.kingrelatedness.com/manual.shtml

See Also

kinship(), coeffTable()

Examples

Run this code
x = cousinPed(1)

# Kinship matrix
k = kinship(x)

# Degrees
deg = kin2deg(k)
deg

# First cousins are 3rd degree
stopifnot(deg['7', '8'] == 3)

Run the code above in your browser using DataLab