######################
# Example 1: Full sibs
######################
x = nuclearPed(2)
k_0 = twoLocusKinship(x, ids = 3:4, rho = 0)
k_0.5 = twoLocusKinship(x, ids = 3:4, rho = 0.5)
stopifnot(k_0 == 1/4, k_0.5 == 1/16)
##################################################
# Example 2: Reproducing Fig. 3 in Thompson (1988)
# Note that in the article, curve (a) is wrong.
# See Erratum: https://doi.org/10.1093/imammb/6.1.1
##################################################
# Pedigrees (a) - (d)
ped.a = linearPed(3)
ped.b = avuncularPed(half = TRUE)
ped.c = cousinPed(1)
ped.d = doubleCousins(1, 1, half1 = TRUE, half2 = TRUE)
peds = list(
a = list(ped = ped.a, ids = c(1,7)),
b = list(ped = ped.b, ids = leaves(ped.b)),
c = list(ped = ped.c, ids = leaves(ped.c)),
d = list(ped = ped.d, ids = leaves(ped.d))
)
twoLocusPlot(peds, coeff = "kinship", lty = 1:4)
Run the code above in your browser using DataLab