knitr::opts_chunk$set(echo = FALSE, results = "asis") knitr::knit_hooks$set(hook_convert_odg = rmdhelp::hook_convert_odg)
\begin{align} y_{ij} &= v_i + e_{ij} \notag \ &= \mu + u_i + d_i + i_i + e_{ij} \notag \end{align}
\begin{tabular}{llp{8cm}} where & & \ & $y_{ij}$ & $j^{th}$ record of animal $i$ \ & $\mu$ & population mean \ & $v_i$ & genotypic value, corresponding to the sum of all additive ($u$), dominance ($d$) and epistatic ($i_i$) effects of the genotype of animal $i$ \ & $e_{ij}$ & random environmental effects of animal $i$ \end{tabular}
#rmdhelp::use_odg_graphic(ps_path = "odg/basicmodelrearrterm.odg") knitr::include_graphics(path = "odg/basicmodelrearrterm.png")
\begin{equation} y_{ij} = \mu_i + u_i + e_{ij}^* \notag \end{equation}
\begin{tabular}{llp{8.5cm}} where & & \ & $y_{ij}$ & $j^{th}$ record of animal $i$ \ & $\mu_i$ & identifiable fixed environmental effect \ & $u_i$ & sum of all additive ($u$) genetic effects of the genotype of animal $i$ \ & $e_{ij}^*$ & dominance, epistatic and random environmental effects of animal $i$ \end{tabular}
# fixing some constants set.seed(9876) n_nr_sample <- 10000 n_nr_comp <- 10^(1:3) # define a function to compute sample means sample_comp_sum <- function(pn_nr_comp, pn_nr_sample){ return(sapply(1:pn_nr_comp, function(x, y) sum(runif(y))/y, pn_nr_sample)) } # vectors with component sums vec_sum_10 <- sample_comp_sum(pn_nr_comp = n_nr_comp[1], pn_nr_sample = n_nr_sample) vec_sum_100 <- sample_comp_sum(pn_nr_comp = n_nr_comp[2], pn_nr_sample = n_nr_sample) vec_sum_1000 <- sample_comp_sum(pn_nr_comp = n_nr_comp[3], pn_nr_sample = n_nr_sample)
# plots opar <- par() par(mfrow=c(1,3)) hist(vec_sum_10) hist(vec_sum_100) hist(vec_sum_1000)
#rmdhelp::use_odg_graphic(ps_path = "odg/decompbreedingvalue.odg") knitr::include_graphics(path = "odg/decompbreedingvalue.png")
Breeding values are predicted according to the following two steps.
$\rightarrow$ plot
#rmdhelp::use_odg_graphic(ps_path = "odg/regbreedingvaluesinglerecord.odg") knitr::include_graphics(path = "odg/regbreedingvaluesinglerecord.png")
\begin{equation} u_i = y_{ij} - \mu_i - e_{ij}^* \notag \end{equation}
\begin{equation} u_i = b * (y_{ij} - \mu_i) + e_{ij}^{**} \notag \end{equation}
\vspace{-2ex} \begin{align} b &= \frac{cov(u,y)}{var(y)} \notag \ &= \frac{cov(u,\mu + u + e)}{var(y)} \notag \ &= \frac{cov(u,u)}{var(y)} \notag \ &= \frac{var(u)}{var(y)} = h^2 \notag \end{align}
where $h^2$ is called heritability
\begin{align} \hat{u_i} &= b * (y_i - \mu) \notag \ &= h^2 * (y_i - \mu) \notag \end{align}
\begin{align} r_{u,y} &= \frac{cov(u, y)}{\sigma_u \ \sigma_y} \notag \ &= \frac{\sigma_u^2}{\sigma_u \ \sigma_y} \notag \ &= \frac{\sigma_u}{\sigma_y} \notag \ &= h \notag \end{align}
\begin{equation} R = i * r_{u,y}^2 * \sigma_y = i * h^2 * \sigma_y \notag \end{equation}
\begin{equation} var(y) = var(u) + var(pe) + var(te) \notag \end{equation}
\begin{equation} t = \frac{var(u) + var(pe)}{var(y)} \notag \end{equation}
\begin{equation} \hat{u_i} = b(\tilde{y_i} - \mu) \notag \end{equation}
\begin{equation} b = \frac{cov(u,\tilde{y})}{var(\tilde{y})} \notag \end{equation}
\begin{equation} cov(u,\tilde{y}) = cov(u, u + pe + {1\over n} \sum_{k=1}^n te_k) = \sigma_u^2 \notag \end{equation}
\begin{equation} var(\tilde{y}) = var(u) + var(pe) + {1\over n} var(te) \notag \end{equation}
\begin{align} var(\tilde{y}) &= t * \sigma_y^2 + {1\over n} (1-t) * \sigma_y^2 \notag \ &= {1\over n}\left( n*t + (1-t) \right) \sigma_y^2 \notag \ &= \frac{1 + (n-1)t}{n} \sigma_y^2 \notag \end{align}
\begin{align} b &= \frac{cov(u,\tilde{y})}{var(\tilde{y})} \notag \ &= \frac{n \sigma_u^2}{(1 + (n-1)t) \sigma_y^2} \notag \ &= \frac{nh^2}{1 + (n-1)t} \notag \end{align}
\begin{equation} \hat{u_i} = b * (\bar{y_i} - \mu) \notag \end{equation}
where
\begin{equation} b = \frac{cov(u_i, \bar{y_i})}{var(\bar{y_i})} \notag \end{equation}
\begin{align} cov(u_i, \bar{y_i}) &= cov(u_i, {1\over 2}u_i + {1\over 2}{1\over n}\sum_{k=1}^n u_{d,i} + {1\over n}\sum_{k=1}^n m_k + {1\over n}\sum_{k=1}^n e_k) \notag \ &= cov(u_i, {1\over 2}u_i) \notag \ &= {1\over 2} cov(u_i, u_i) = {1\over 2} \sigma_u^2 \notag \end{align}
\begin{equation} var(\bar{y_i}) = (t + (1-t)/n) \sigma_y^2 \notag \end{equation}
with $t = h^2 / 4$
Progeny mean \begin{align} \bar{y_i} &= {1 \over n} \sum_{k=1}^ny_k = {1 \over n} \sum_{k=1}^n u_k + {1 \over n} \sum_{k=1}^n e_k \notag \ &= {1 \over n} \sum_{k=1}^n (1/2 u_i + 1/2 u_{d,k}) + {1 \over n} \sum_{k=1}^n e_k \notag \ &= {1 \over 2} u_i + {1 \over n} \sum_{k=1}^n 1/2 u_{d,k} + {1 \over n} \sum_{k=1}^n e_k \notag \end{align}
Variance \begin{align} var(\bar{y_i}) &= var({1 \over 2} u_i) + var({1 \over n} \sum_{k=1}^n 1/2 u_{d,k}) + var({1 \over n} \sum_{k=1}^n e_k) \notag \end{align}
with $cov(.) = 0$, $t = var({1 \over 2} u_i) / var(y) = h^2/4$
\begin{align} b &= \frac{1/2 \sigma_u^2}{(t + (1-t)/n) \sigma_y^2} \notag \ &= \frac{1/2 h^2 \sigma_y^2}{({1\over 4}h^2 + (1 - {1\over 4}h^2)/n) \sigma_y^2} \notag \ &= \frac{2nh^2}{nh^2 + (4-h^2)} \notag \ &= \frac{2n}{n + (4-h^2)/h^2} \notag \ &= \frac{2n}{n+k} \notag \end{align}
with $k=\frac{4-h^2}{h^2}$.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.