knitr::opts_chunk$set(echo = FALSE, results = "asis") knitr::knit_hooks$set(hook_convert_odg = rmdhelp::hook_convert_odg)
At the genetic level there are two different kinds of similarity
#rmdhelp::use_odg_graphic(ps_path = "odg/ibdvsibs.odg") knitr::include_graphics(path = "odg/ibdvsibs.png")
If both parents $s$ and $d$ of animal $i$ are known then
If only one parent $s$ is known and assumed unrelated to the mate
If both parents are unknown
#rmdhelp::use_odg_graphic(ps_path = "odg/pedexamplegraph.odg") knitr::include_graphics(path = "odg/pedexamplegraph.png")
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")
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)
r n_nr_ani_ped
\times r n_nr_ani_ped
$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")
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")
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")
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")
r n_nr_ani_ped
$ using the same recipe### # display cat("$$\n") cat("A = \\left[") cat(paste(rmdhelp::sConvertMatrixToLaTexArray(pmatAMatrix = matA, pnDigits = 4), collapse = "\n"), "\n") cat("\\right]\n") cat("$$\n")
Recap: Henderson's mixed model equations depend on four matrices
Design matrix $X$ for the fixed effects
$$G = A * \sigma_u^2$$
$$G^{-1} = A^{-1} * {1\over \sigma_u^2}$$
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.