kin2deg: Degree of relationship

View source: R/coeffTable.R

kin2degR Documentation

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)

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)

Value

An integer vector of the same length as kin.

References

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

See Also

kinship(), coeffTable()

Examples

x = cousinPed(1)

# Kinship matrix
k = kinship(x)

# Degrees
deg = kin2deg(k)
deg

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


ribd documentation built on May 29, 2024, 8:43 a.m.