Learn R Programming

pcgen (version 0.2.0)

getResiduals: Residuals from the GBLUP

Description

Residuals from the best linear unbiased predictor of the genetic effects (GBLUP), which is computed given REML-estimates of the variance components.

Usage

getResiduals(suffStat, covariates = NULL, cov.method = "uni", K = NULL)

Arguments

suffStat

A data.frame, of which the first column is the factor G (genotype), and subsequent columns contain the traits. The name of the first column should be G.

covariates

A data.frame containing covariates, that should always be used in each conditional independence test. Should be either NULL (default) or a data.frame with the same number of rows as suffStat. An intercept is already included for each trait in suffStat; covariates should not contain a column of ones.

cov.method

(A string, specifying which method should be used to compute the GBLUP. Options are "us" (unstructured multi-trait model fitted using sommer) and "uni" (based on univariate GBLUPs). Default is "uni").

K

A genetic relatedness matrix. If NULL (default), independent genetic effects are assumed.

Value

A data-frame with the residuals.

Details

If cov.method = "uni", the GBLUP and the residuals are computed separately for each trait in suffStat. The covariance of each trait is then assumed to be $$\sigma_G^2 Z K Z^t + \sigma_E^2 I_n$$ where \(Z\) is a binary incidence matrix, assigning plants or plots to genotypes. \(Z\) is based on the first column in suffStat. If there is a single observation per genotype (typically a genotypic mean), \(Z\) is the identity matrix, and the relatedness matrix \(K\) should be specified. If there are replicates for at least some of the genotypes, and no \(K\) is provided, independent genetic effects are assumed (\(K\) will be the identity matrix). It is also possible to have replicates and specify a non-diagonal \(K\). Whenever \(K\) is specified, sommer (mmer2) will be used; otherwise lmer (lme4). The mmer2 is also used when cov.method = "us", in which case the multivariate GBLUP is computed, for all traits in suffStat simultaneously. This is only possible for a limited number of traits.

References

Covarrubias-Pazaran, G., 2016. Genome-assisted prediction of quantitative traits using the R package sommer. PloS one, 11(6), p.e0156744.

Examples

Run this code
# NOT RUN {
<!-- %\donttest{ -->
# }
# NOT RUN {
data(simdata)
rs <- getResiduals(suffStat= simdata)
# }
# NOT RUN {
<!-- %} -->
# }

Run the code above in your browser using DataLab