# Full Siblings are double IBD with 25% probability
# we may compute the expectation and variance of the total length of
# a chromosome that is double IBD for a chromosome of 100 cM (i.e. 1 Morgan)
m <- total_ibd_dist_moments(pedigree = pedtools::nuclearPed(nch = 2),
ibd_state = 2, chromosome_length = 100)
m
# compare to numerical integration of the full distribution
d_fs <- total_ibd_dist(pedigree = pedtools::nuclearPed(nch = 2),
ibd_state = 2, chromosome_length = 100)
m2 <- list(mean = E(d_fs), variance = var(d_fs), sd = sd(d_fs))
m2
stopifnot(all.equal(m, m2))
# Expectation and variance of _fraction_ of the genome that is
# double IBD between four full siblings
m4 <- total_ibd_dist_moments(pedigree = pedtools::nuclearPed(nch = 4),
ibd_state = 2, chromosome_length = 100, fraction = TRUE)
m4
stopifnot(all.equal(0.25^3, m4$mean))
Run the code above in your browser using DataLab