getTInv | R Documentation |
Get inverse gene flow matrix from a pedigree.
getTInv(ped)
ped |
|
matrix (dtCMatrix
- lower unitriangular sparse)
ped <- pedigree(sire = c(NA, NA, 1, 1, 4, 5),
dam = c(NA, NA, 2, NA, 3, 2),
label = 1:6)
(TInv <- getTInv(ped))
# Test for correctness
TInvExp <- matrix(data = c( 1.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0, 0.0, 0.0,
-0.5, -0.5, 1.0, 0.0, 0.0, 0.0,
-0.5, 0.0, 0.0, 1.0, 0.0, 0.0,
0.0, 0.0, -0.5, -0.5, 1.0, 0.0,
0.0, -0.5, 0.0, 0.0, -0.5, 1.0),
byrow = TRUE, nrow = 6)
stopifnot(!any(abs(TInv - TInvExp) > .Machine$double.eps))
stopifnot(is(TInv, "sparseMatrix"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.