# NOT RUN {
# Child of half siblings: f = 1/8
x = halfCousinPed(0, child = TRUE)
inbreeding(x)
# If the father is 100% inbred, the inbreeding coeff of the child doubles
fa = commonAncestors(x, 4:5) # robust to label change
founderInbreeding(x, fa) = 1
inbreeding(x)
# Simpler output using the `ids` argument:
inbreeding(x, ids = 6)
### X-chromosomal inbreeding coefficients ###
# These depend on the genders in the pedigree.
# To exemplify, we consider a child of half siblings.
xPat = halfSibPed(sex2 = 2) # paternal half sibs
xPat = addChildren(xPat, father = 4, mother = 5, nch = 1, sex = 2)
stopifnot(inbreedingX(xPat, ids = 6) == 0)
# Change to maternal half sibs => coeff becomes 1/4.
xMat = swapSex(xPat, 1)
stopifnot(inbreedingX(xMat, ids = 6) == 0.25)
# Example with selfing and complete inbreeding
s = selfingPed(1)
founderInbreeding(s, 1) = 1
inbreeding(s, ids = 2)
# }
Run the code above in your browser using DataLab