relfactorInv | R Documentation |
Get inverse of the left Cholesky factor of the relationship
matrix for the pedigree ped
.
relfactorInv(ped)
getLInv(ped)
ped |
|
Note that the inverse of the left Cholesky factor is returned, which is lower triangular, that is from A = LL' (lower inv(A) = inv(LL') = inv(L)' inv(L) (upper triangular).
matrix (dtCMatrix
- triangular sparse)
getLInv()
: Inverse relationship factor from a pedigree
ped <- pedigree(sire = c(NA, NA, 1, 1, 4, 5),
dam = c(NA, NA, 2, NA, 3, 2),
label = 1:6)
(LInv <- getLInv(ped))
solve(Matrix::t(getL(ped)))
# Test for correctness
LInvExp <- matrix(data = c( 1.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
0.0000, 1.0000, 0.0000, 0.0000, 0.0000, 0.0000,
-0.7071, -0.7071, 1.4142, 0.0000, 0.0000, 0.0000,
-0.5774, 0.0000, 0.0000, 1.1547, 0.0000, 0.0000,
0.0000, 0.0000, -0.7071, -0.7071, 1.4142, 0.0000,
0.0000, -0.7303, 0.0000, 0.0000, -0.7303, 1.4606),
byrow = TRUE, nrow = 6)
stopifnot(!any(abs(round(LInv, digits = 4) - LInvExp) > .Machine$double.eps))
L <- t(chol(getA(ped)))
LInvExp <- solve(L)
stopifnot(!any(abs(LInv - LInvExp) > .Machine$double.eps))
stopifnot(is(LInv, "sparseMatrix"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.