makeTinv | R Documentation |
This returns the Cholesky decomposition of the numerator relationship matrix and its inverse. It can also be used to obtain coefficients of inbreeding for the pedigreed population.
makeTinv(pedigree, ...)
## Default S3 method:
makeTinv(pedigree, ...)
## S3 method for class 'numPed'
makeTinv(pedigree, ...)
## Default S3 method:
makeT(pedigree, genCol = NULL, ...)
## Default S3 method:
makeDiiF(pedigree, f = NULL, ...)
## S3 method for class 'numPed'
makeDiiF(pedigree, f = NULL, ...)
pedigree |
A pedigree where the columns are ordered ID, Dam, Sire |
... |
Arguments to be passed to methods |
genCol |
An integer value indicating the generation up to which the
|
f |
A numeric indicating the level of inbreeding. See Details |
Missing parents (e.g., base population) should be denoted by either 'NA', '0', or '*'.
The function implements an adaptation of the Meuwissen and Luo (1992)
algorithm (particularly, following the description of the algorithm in
Mrode 2005) with some code borrowed from the inverseA
function by
Jarrod Hadfield in the MCMCglmm
package.
At the moment, providing the inbreeding level of individuals or the base population has not been implemented. However, this argument is a placeholder for now.
a list
:
the inverse of the Cholesky decomposition of the additive genetic relationship matrix (Ainv=Tinv' Dinv Tinv) in sparse matrix form
the diagonal D matrix of the A=TDT' Cholesky decomposition. Contains the variance of Mendelian sampling. Matches the order of the first/ID column of the pedigree.
the individual coefficients of inbreeding for each individual in the pedigree (matches the order of the first/ID column of the pedigree).
Meuwissen, T.H.E & Luo, Z. 1992. Computing inbreeding coefficients in large populations. Genetics, Selection, Evolution. 24:305-313.
Mrode, R.A. 2005. Linear Models for the Prediction of Animal Breeding Values, 2nd ed. Cambridge, MA: CABI Publishing.
makeAinv
, makeA
Tinv <- makeTinv(Mrode2)
# Method for a numeric pedigree (of `nadiv` class "numPed")
nPed <- numPed(Mrode2)
Tinv2 <- makeTinv(nPed)
########
DF <- makeDiiF(Mrode2)
# manually construct the inverse of the relatedness matrix `Ainv`
Dinv <- DF$D #<-- not the inverse yet, just copying the object
Dinv@x <- 1 / DF$D@x #<-- inverse of a diagonal matrix
handAinv <- crossprod(Tinv, Dinv) %*% Tinv
# make the A-inverse directly
Ainv <- makeAinv(Mrode2)$Ainv
# Compare
handAinv
Ainv
stopifnot(all(abs((Ainv - handAinv)@x) < 1e-6))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.