knitr::opts_chunk$set(echo = TRUE) # rmdhelp::show_knit_hook_call() knitr::knit_hooks$set(hook_convert_odg = rmdhelp::hook_convert_odg)
During the lecture the method of computing the inverse numerator relationship matrix $A^{-1}$ directly was introduced. The computation is based on the LDL-decomposition. As a result, we can write
$$A^{-1} = (L^T)^{-1} \cdot D^{-1} \cdot L^{-1}$$ where $L^{-1} = I-P$, and $D^{-1}$ is a diagonal matrix with $(D^{-1})_{ii} * \sigma_u^{-2} = var(m_i)^{-1}$.
getAinv()
from package pedigreemm.nr_animal <- 6 tbl_pedigree <- tibble::tibble(Calf = c(1:nr_animal), Sire = c(NA, NA, NA, 1 ,3, 4), Dam = c(NA, NA, NA, 2, 2, 5)) tbl_pedigree
The matrix $P$ comes from the simple decomposition and can be constructed using the pedigree.
P = matrix(0, nrow = nr_animal, ncol = nr_animal) for (i in 1:nr_animal){ s <- tbl_pedigree$Sire[i] d <- tbl_pedigree$Dam[i] if (!is.na(s)){ P[i,s] <- 0.5 } if(!is.na(d)){ P[i,d] <- 0.5 } } P
With that the matrix $L^{-1}$ is
I <- diag(1, nrow = nr_animal, ncol = nr_animal) Linv <- I - P Linv
The matrix $D$ is obtained from package pedigreemm
ped <- pedigreemm::pedigree(sire = tbl_pedigree$Sire, dam = tbl_pedigree$Dam, label = as.character(1:nr_animal)) D <- pedigreemm::Dmat(ped = ped) Dinv <- diag(1/D, nrow = nr_animal, ncol = nr_animal) Dinv
The inverse numerator relationship matrix is
Ainv <- t(Linv) %*% Dinv %*% Linv Ainv
pedigreemm::getAInv(ped = ped)
The following diagram helps to illustrate the rules for constructing $A^{-1}$
#rmdhelp::use_odg_graphic(ps_path = "odg/inv-num-mat.odg") knitr::include_graphics(path = "odg/inv-num-mat.png")
In what follows, we use the following convention $\delta_i = (D^{-1})_{ii}$.
We start with animal $1$.
#rmdhelp::use_odg_graphic(ps_path = "odg/inm-animal1.odg") knitr::include_graphics(path = "odg/inm-animal1.png")
Animal $1$ has no parents and therefore the diagonal element $\delta_1 = (D^{-1}){11}$ of matrix $D^{-1}$ is $\delta{1} = 1$. By looking at the red boxes, we can see that $\delta_1$ is added as a contribution to $(A^{-1}){11}$. So far we are still missing a contribution of $0.5$ to the element $(A^{-1}){11}$. Again by inspecting the red boxes in the above diagram, we can see that this contribution corresponds to $\delta_4 /4$ which comes from offspring $4$ of parent $1$. Hence diagonal elements of $(A^{-1})_{ss}$ corresponding to parents $s$ of offsprint $i$ receive $\delta_i/4$ as contribution. More details on that is obtained when inspecting the contributions of animal $4$. Animals $2$ and $3$ do not have parents and are therefore analogous to animal $1$.
Animal $4$ has parents $1$ and $2$.
#rmdhelp::use_odg_graphic(ps_path = "odg/inm-animal4.odg") knitr::include_graphics(path = "odg/inm-animal4.png")
The red boxes in the above diagram show that for animal $4$ there is a contribution of $\delta_4$ to the diagonal. Then there are contributions of $\delta_4/4$ for the elements $(A^{-1}){11}$, $(A^{-1}){22}$, $(A^{-1}){12}$ and $(A^{-1}){21}$. Furthermore there are negative contributions of $\delta_4/2$ to $(A^{-1}){41}$, $(A^{-1}){14}$, $(A^{-1}){24}$ and $(A^{-1}){42}$.
From this the general rules which were first published by Henderson can be deduced as
Both Parents Known
Only One Parent Known
Both Parents Unknown
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.