knitr::opts_chunk$set(echo = FALSE, results = "asis") knitr::knit_hooks$set(hook_convert_odg = rmdhelp::hook_convert_odg)
$\rightarrow$ univariate analyses
$\rightarrow$ multi-trait or multiple trait
### # selection thresolods n_milk_sel_thr <- 6900 n_prot_sel_thr <- 3.5 ### # mean and sd of traits n_nr_trait <- 2 n_milk_mean <- 6800 n_milk_sd <- 600 n_prot_mean <- 3.4 n_prot_sd <- .2 n_corr <- -.4 ### # variance - covariance matrix n_cov <- n_corr * n_milk_sd * n_prot_sd mat_varcov <- matrix(c(n_milk_sd^2, n_cov, n_cov, n_prot_sd^2), nrow = n_nr_trait, ncol = n_nr_trait, byrow = TRUE) ### # generate observations n_nr_obs <- 50 ### # cholesky decomposition of varcov mat_varcov_chol <- chol(mat_varcov) ### # generate independent observations set.seed(5432) mat_unrel_obs <- matrix(c(rnorm(n_nr_obs),rnorm(n_nr_obs)), nrow = n_nr_trait, byrow = TRUE) mat_obs <- crossprod(mat_unrel_obs, mat_varcov_chol) + matrix(c(n_milk_mean, n_prot_mean), nrow=n_nr_obs, ncol=n_nr_trait, byrow = TRUE)
### # convert data matrix into a tibble that is later used for plotting tbl_milk_prot <- tibble::as_tibble(mat_obs) colnames(tbl_milk_prot) <- c("Milk", "Protein") ### # define the colours of the threshold lines s_col_milk_thr <- "red" s_col_prot_thr <- "blue" ### # use ggplot2 to do the plot library(ggplot2) milk_prot_plot <- qplot(Milk, Protein, data=tbl_milk_prot, geom="point", xlab = "Milk Yield", ylab = "Protein Content") milk_prot_plot <- milk_prot_plot + geom_hline(yintercept = n_prot_sel_thr, colour = s_col_prot_thr) + geom_vline(xintercept = n_milk_sel_thr, colour = s_col_milk_thr) print(milk_prot_plot)
$\rightarrow$ exclusion of very many animals and reduction in genetic variability
$\rightarrow$ genetic gain will not be as expected
$\rightarrow$ threshold in all traits above positive predicted breeding values emphasizes traits with high heritability
$$H = w^Tu$$
$$I = b^T\hat{u}$$
$$b = P^{-1}Gw$$
First possible implementation
Imrprovement
$$y_1 = X_1 \beta_1 + Z_1u_1 + e_1$$ $$y_2 = X_2 \beta_2 + Z_2u_2 + e_2$$
$$\left[ \begin{array}{c} y_1 \ y_2 \end{array} \right] = \left[ \begin{array}{lr} X_1 & 0 \ 0 & X_2 \end{array} \right] \left[ \begin{array}{c} \beta_1 \ \beta_2 \end{array} \right] + \left[ \begin{array}{lr} Z_1 & 0 \ 0 & Z_2 \end{array} \right] \left[ \begin{array}{c} u_1 \ u_2 \end{array} \right] + \left[ \begin{array}{c} e_1 \ e_2 \end{array} \right] $$
$$\left[ \begin{array}{c} y_1 \ y_2 \end{array} \right] = \left[ \begin{array}{lr} X_1 & 0 \ 0 & X_2 \end{array} \right] \left[ \begin{array}{c} \beta_1 \ \beta_2 \end{array} \right] + \left[ \begin{array}{lr} Z_1 & 0 \ 0 & Z_2 \end{array} \right] \left[ \begin{array}{c} u_1 \ u_2 \end{array} \right] + \left[ \begin{array}{c} e_1 \ e_2 \end{array} \right] $$
can be written as
$$y = X \beta + Zu + e$$
with $y = \left[ \begin{array}{c} y_1 \ y_2 \end{array} \right]$, $\beta = \left[ \begin{array}{c} \beta_1 \ \beta_2 \end{array} \right]$, $u = \left[ \begin{array}{c} u_1 \ u_2 \end{array} \right]$, $e = \left[ \begin{array}{c} e_1 \ e_2 \end{array} \right]$
\vspace{2ex} $X = \left[ \begin{array}{lr} X_1 & 0 \ 0 & X_2 \end{array} \right]$, $Z = \left[ \begin{array}{lr} Z_1 & 0 \ 0 & Z_2 \end{array} \right]$
$$G_0 = \left[ \begin{array}{lr} \sigma_{g_{1}}^2 & \sigma_{g1,g2} \ \sigma_{g1,g2} & \sigma_{g_{2}}^2 \end{array} \right] = \left[ \begin{array}{lr} g_{11} & g_{12} \ g_{21} & g_{22} \end{array} \right] $$
\left[ \begin{array}{lr} g_{11}A & g_{12}A \ g_{21}A & g_{22}A \end{array} \right] = G_0 \otimes A = G $$
$$R_0 = \left[ \begin{array}{lr} r_{11} & r_{12} \ r_{21} & r_{22} \end{array} \right]$$
$$
R = var(e) = var\left[\begin{array}{c} e_1 \ e_2 \end{array} \right]
=
\left[
\begin{array}{lr}
r_{11}I_n & r_{12}I_n \
r_{21}I_n & r_{22}I_n
\end{array}
\right]
= R_0 \otimes I_n
$$
$$ \left[ \begin{array}{lr} X^TR^{-1}X & X^TR^{-1}Z \ Z^TR^{-1}X & Z^TR^{-1}Z + G^{-1} \end{array} \right] \left[ \begin{array}{c} \hat{\beta} \ \hat{u} \end{array} \right] = \left[ \begin{array}{c} X^TR^{-1}y \ Z^TR^{-1}y \end{array} \right] $$
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.