knitr::opts_chunk$set(echo = FALSE, results = "asis")
knitr::knit_hooks$set(hook_convert_odg = rmdhelp::hook_convert_odg)

Similarity Between Individuals {#similaritybetweenindividuals}

At the genetic level there are two different kinds of similarity

  1. Identity by descent (IBD)
  2. Identity by state

IBD versus IBS

#rmdhelp::use_odg_graphic(ps_path = "odg/ibdvsibs.odg")
knitr::include_graphics(path = "odg/ibdvsibs.png")

Numerator Relationship Matrix

Recursive Computation of $A$

Example

#rmdhelp::use_odg_graphic(ps_path = "odg/pedexamplegraph.odg")
knitr::include_graphics(path = "odg/pedexamplegraph.png")

Tabular Representation of Pedigree

suppressPackageStartupMessages( library(pedigreemm) )
n_nr_ani_ped <- 6
n_nr_parent <- 2
tbl_ped <- tibble::tibble(Calf = c((n_nr_parent+1):n_nr_ani_ped),
                             Sire = c(1, 1, 4, 5),
                             Dam  = c(2, NA, 3, 2))
ped <- pedigree(sire = c(rep(NA, n_nr_parent), tbl_ped$Sire), dam = c(rep(NA, n_nr_parent), tbl_ped$Dam), label = as.character(1:n_nr_ani_ped))
matA <- as.matrix(getA(ped = ped))
matAinv <- as.matrix(getAInv(ped = ped))
ped
knitr::kable(tbl_ped,
             booktabs = TRUE,
             longtable = TRUE,
             caption = "Example Pedigree To Compute Additive Genetic Relationship Matrix")

Stepwise Computation of $A$

tbl_ped_extended <- tibble::tibble(Animal = c(1:n_nr_ani_ped),
                                      Sire = c(NA, NA, 1, 1, 4, 5),
                                      Dam  = c(NA, NA, 2, NA, 3, 2))

knitr::kable(tbl_ped_extended,
             booktabs = TRUE,
             longtable = TRUE)

Initialize With Empty Matrix $A$

matA_empty <- matrix(NA, nrow = n_nr_ani_ped, ncol = n_nr_ani_ped)
### # display
cat("$$\n")
cat("A = \\left[")
cat(paste(rmdhelp::sConvertMatrixToLaTexArray(pmatAMatrix = matA_empty), collapse = "\n"), "\n")
cat("\\right]\n")
cat("$$\n")

First Diagonal Element

matA_empty[1,1] <- matA[1,1]
### # display
cat("$$\n")
cat("A = \\left[")
cat(paste(rmdhelp::sConvertMatrixToLaTexArray(pmatAMatrix = matA_empty), collapse = "\n"), "\n")
cat("\\right]\n")
cat("$$\n")

Off-diagonal Elements

First Row of $A$

matA_empty[1,] <- matA[1,]
### # display
cat("$$\n")
cat("A = \\left[")
cat(paste(rmdhelp::sConvertMatrixToLaTexArray(pmatAMatrix = matA_empty), collapse = "\n"), "\n")
cat("\\right]\n")
cat("$$\n")

Use Symmetry of $A$

matA_empty[,1] <- matA[,1]
### # display
cat("$$\n")
cat("A = \\left[")
cat(paste(rmdhelp::sConvertMatrixToLaTexArray(pmatAMatrix = matA_empty), collapse = "\n"), "\n")
cat("\\right]\n")
cat("$$\n")

Remaining Elements of $A$

Final Result

### # display
cat("$$\n")
cat("A = \\left[")
cat(paste(rmdhelp::sConvertMatrixToLaTexArray(pmatAMatrix = matA, pnDigits = 4), collapse = "\n"), "\n")
cat("\\right]\n")
cat("$$\n")

The Inverse Numerator Relationship Matrix {#inversenumeratorrelationshipmatrix}

Animal Model

$$G = A * \sigma_u^2$$

$$G^{-1} = A^{-1} * {1\over \sigma_u^2}$$

Need For Efficient Computation of $A{-1}$



charlotte-ngs/lbgfs2020 documentation built on Dec. 20, 2020, 5:39 p.m.