getGenCov: Genetic covariances

Description Usage Arguments Details Author(s) Examples

View source: R/getGenCov.R

Description

Obtaing pairwise genetic covariances for variables with the same experimental design and equal variance

Usage

1
2
getGenCov(y1, y2, X = NULL, Z = NULL, K = NULL, 
      U = NULL, d = NULL, scale = TRUE, mc.cores = 1, ...)

Arguments

y1

Response variable 1

y2

Response variable 2. Must be a matrix with the number of rows equal to length of vector y2

X

Design matrix for the fixed effects. When X=NULL a vector of ones is constructed only for the intercept (default)

Z

Design matrix for the random effects. When Z=NULL an identity matrix is considered (default) thus G = K; otherwise G = Z K Z' is used

K

Kinship relationships matrix

U

Matrix with eigenvectors from spectral value decomposition of G = U D U'

d

Vector with eigenvalues from spectral value decomposition of G = U D U'

scale

TRUE or FALSE to scale y1 and y2 by their corresponding standard deviations so the resulting variables will have unit variance

mc.cores

Number of cores used. The analysis is run in parallel when mc.cores is greater than 1. Default is mc.cores=1

...

Other arguments passed to fitBLUP function

Details

Assumes that both y1 and y2 follow the basic linear mixed model that relates phenotypes with genetic values of the form

y1 = X b1 + Z g1 + e1
y2 = X b2 + Z g2 + e2

where b1 and b2 are the specific fixed effects, g1 and g2 are the specific genetic values of the genotypes, e1 and e2 are the vectors of specific environmental residuals, and X and Z are common design matrices conecting the fixed and genetic effects with replicates. Genetic values are assumed to follow a Normal distribution as g1 ~ N(02u1K) and g2 ~ N(02u2K), and environmental terms are assumed e1 ~ N(02e1I) and e2 ~ N(02e2I).

The genetic covariance σ2u1,u2 is estimated from the formula for the variance for the sum of two variables as

σ2u1,u2 = 1/2(σ2u3 - σ2u1 - σ2u2)

where σ2u3 is the genetic variance of the variable y3 = y1 + y2 that also follows the same model as for y1 and y2

Author(s)

Marco Lopez-Cruz (lopezcru@msu.edu) and Gustavo de los Campos

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
  require(SFSI)
  require(ggplot2)
  data(wheatHTP)
  
  X = scale(X[1:200,])         # Subset and scale markers
  G = tcrossprod(X)/ncol(X)    # Genomic relationship matrix
  y = scale(Y[1:200,"YLD"])    # Subset response variable
  WL = scale(WL[1:200,20:40])  # Subset reflectance data
  
  fm <- getGenCov(y,WL,K=G)
  
  dat = data.frame(covU=fm$covU,covP_corrected=fm$covU+fm$covE,
        covP_uncorrected=cov(y,WL)[1,])
  
  covariance=rep(c("covU","covP_corrected","covP_uncorrected"),each=length(fm$covU))
  dat = data.frame(covariance,x=rep(1:length(fm$covU),3),
                  y=c(fm$covU,fm$covU+fm$covE,cov(y,WL)[1,]))
  ggplot(dat,aes(x,y,group=covariance,color=covariance))+geom_point()+geom_line()    

MarcooLopez/SFSI_data documentation built on April 15, 2021, 10:53 a.m.