Converts a vector of kinship coefficients to "degrees of relationship", as used by some software for relatedness inference (e.g. KING).
kin2deg(kin, unrelated = Inf)
An integer vector of the same length as kin
.
A vector of kinship coefficients, i.e., numbers in [0, 1]
.
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.
The implementation uses the conversion formula
[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)
KING manual with thresholds for relationship degrees: https://www.kingrelatedness.com/manual.shtml
kinship()
, coeffTable()
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