# NOT RUN {
###############################
# Classic example of three relationships with equal one-locus coeffs
peds = list(
GrandParent = list(ped = linearPed(2), ids = c(1, 5)),
HalfSib = list(ped = halfSibPed(), ids = c(4, 5)),
Uncle = list(ped = cousinPed(0, 1), ids = c(3, 6)))
twoLocusPlot(peds, coeff = "kinship")
twoLocusPlot(peds, coeff = "k11")
###############################
peds = list(
PO = list(ped = nuclearPed(1), ids = c(1,3)),
S = list(ped = nuclearPed(2), ids = c(3,4)))
twoLocusPlot(peds, coeff = "kinship")
twoLocusPlot(peds, coeff = "k11")
###############################
peds = list(
`H-sibs` = list(ped = addChildren(halfSibPed(sex2 = 2), 4, 5, nch = 2),
ids = 6:7),
`G-sibs` = list(ped = addChildren(addDaughter(nuclearPed(1), 3), 1, 5, nch = 2),
ids = 6:7),
`U-sibs` = list(ped = addChildren(addDaughter(nuclearPed(2), 4), 3, 6, nch = 2),
ids = 7:8)
)
# plotPedList(peds)
twoLocusPlot(peds, coeff = "kinship")
################################
### Example where `coeff` is a function.
### Reproducing Fig 2 of Bishop & Williamson (1990)
# The coefficient d11(rho) is the conditional probability of IBD = 1
# in the first locus, given IBD = 1 in the second.
peds = list(
GrandParent = list(ped = linearPed(2), ids = c(1, 5)),
HalfSib = list(ped = halfSibPed(), ids = c(4, 5)),
Uncle = list(ped = cousinPed(0, 1), ids = c(3, 6)),
FirstCous = list(ped = cousinPed(1), ids = c(5, 8)),
FirstCous1R = list(ped = cousinPed(1, 1), ids = c(5, 10)),
SecondCous = list(ped = cousinPed(2), ids = c(7, 12)))
d11 = function(ped, ids, rho) {
twoLocusIBD(ped, ids, rho, coefs = "k11")/kappaIBD(ped, ids)[2]
}
twoLocusPlot(peds, coeff = d11)
# }
Run the code above in your browser using DataLab