# Variance Components

Methods such as BLUP, Single-step Genomic BLUP, and Single-step Hybrid Marker Effects Models used to predict Expected Progeny Difference (EPD) are based on models which include random effects. Associated with these random effects are parameters known as variance components. For example, a typical model to predict the EPD using BLUP would include random effects for the additive genetic merit and environmental effects. Each of these would have an associated variance component, in this case additive genetic variance and environmental variance which quantify the amount variability associated with the two random effects. As these variance components are unknown, they must be estimated.

For methods based on linear mixed models, such as BLUP and Single-step Genomic BLUP, variance components can be estimated using Residual Maximum Likelihood (REML)  while for methods based on Bayesian models, such as Single-step Hybrid Marker Effects Models, variance components can be estimated by corresponding Bayesian methods .

## REML

Both REML and the Bayesian methods work with the likelihood of the data. A likelihood is a measure of how likely a set of data is for different values of the parameters. In the case of REML, it uses the likelihood of the observed residuals where the residual, $\hat r=y-\hat y,$ is the difference between the observed data, $y$, and the estimated data, $\hat y$, given fixed effects such as contemporary group effects. The REML estimates are then the values of the variance components that maximize the likelihood of the observed residuals. In some cases, it is not possible to maximize residual likelihood directly and a variety of iterative algorithms such as Expectation Maximization, Fisher Scoring, and Average Information have been used to numerically find the estimates. These algorithms do have commonality in that they all use BLUP of the random effects obtained from the mixed-model equations.

For a trait such as calving difficulty, genetic evaluation might use a threshold model  instead of a linear mixed model. In the case of a threshold model, it is no longer feasible to find either the likelihood or the residual likelihood. For threshold models where REML is no longer an option, penalized quasi-likelihood based methods  can be used to obtain REML-like estimates of the variance components.

## Bayesian methods

Bayesian methods make use of a prior distribution on the variance components in addition to the information coming from the likelihood to form the posterior distribution. In most cases, the prior is selected with the aim that it has little impact on the estimates. The two predominant types of Bayes estimators are the posterior mode and the posterior mean. Posterior mode estimates are the values of the variance components that maximize the likelihood of the posterior distribution. Posterior mean estimates are the average values of the variance components sampled from the posterior distribution.

Markov chain Monte Carlo (MCMC) is a general method of generating random samples from a posterior distribution. Briefly, the method starts with an initial sample of the unknown parameters (e.g. variance components, fixed effects), and using the initial sample and the posterior distribution, generates the second sample of the parameters; the second sample is then used to generate the third sample, and the cycle continues until the desired number of samples have been obtained. After the samples have been obtained, the estimate of a variance component is the average of the sample values of that variance component. A large number of samplers exist for generating an MCMC sample, of which the Gibbs sampler is commonly used. A Gibbs sampler generates samples for each parameter sequentially conditional on the current values of the other parameters.