## Basic example: IBD along one chromosome for half siblings
L <- 300
r_hs <- r_cibd(n = 1e4, pedigree = pedtools::halfSibPed(), chromosome_length = 300)
# half sibs alternate between IBD (state 1) and not IBD (state 0)
head(r_hs$samples)
# the total_length and number of segments per sample are also returned
head(r_hs$stats)
## Comparing half siblings and grandparent-grandchild
r_gp <- r_cibd(n = 1e4, pedigree = pedtools::linearPed(2), ids = c(1, 5),
chromosome_length = 300)
hist(r_gp$stats$total_length)
hist(r_hs$stats$total_length)
Run the code above in your browser using DataLab