magnusdv / ribd

Computation of pedigree-based relatedness coefficients. Part of the ped suite packages for pedigree analysis in R
https://magnusdv.github.io/pedsuite/
6 stars 1 forks source link

`twoLocusIdentity()` example suggested #8

Closed thoree closed 5 years ago

thoree commented 5 years ago

Here's an example that runs nicely:

library(ribd, quietly = TRUE)
#> 
#> Attaching package: 'ribd'
#> The following object is masked from 'package:base':
#> 
#>     kappa
x1 = halfCousinPed(1)
j2.1 = twoLocusIdentity(x1, ids = leaves(x1), rho = 0.25)
x2 = halfCousinPed(0, removal = 2)
j2.2 = twoLocusIdentity(x2, ids = leaves(x2), rho = 0.25)
stopifnot(all(j2.1 == j2.2))

Created on 2019-09-01 by the reprex package (v0.3.0)

magnusdv commented 5 years ago

Very nice - in the spirit of Donnelly ('83).

PS: These are non-inbred relationships, though, so one might argue that it is a bit of an overkill to use twoLocusIdentity() here. The simpler twoLocusIBD() suffices.

magnusdv commented 5 years ago

Added to twoLocusIBD()docs now: 71f9881