Module3.md

Reaction-Norm Module

maintence

  • We provide Genomic and Envirotypic kernels for reaction norm prediction. After generate the kernels, the user must use the BGGE package to run the models

Toy Example: genomic prediction for grain yield in tropical maize

require(EnvRtype)
data("maizeYield") # 150 maize hybrids over 5 environments (grain yield data)
data("maizeG")     # GRM for maizeYield
data('maizeWTH')   # weather data for maize Yield

Y <- maizeYield
G <- maizeG
df.clim <- maizeWTH

Statistical Models

  • Returns benchmark main effect model:

MM <- get_kernel(K_G = list(G=G),Y = Y,reaction = F,model = 'MM')
  • Returns benchmark main GxE deviation model:

MDs <-get_kernel(K_G = list(G=G),Y = Y,reaction = F,model = 'MDs')
  • Obtaining environmental variables based on quantiles
Env.data<-W.matrix(env.data = df.clim,by.interval = T,statistic = 'quantile',time.window = c(0,14,35,60,90,120))
dim(Env.data)
  • Creating Env Kernels from W matrix and Y dataset
H <- EnvKernel(env.data = Env.data,Y = Y,merge = T,env.id = 'env')
dim(H)
dim(H$varCov) # variable relationship
dim(H$envCov) # environmental relationship

require(superheat)
superheat(H$envCov,row.dendrogram = T,col.dendrogram = T)
 ```

> * Parametrization by 

<p align="center">
<img width="110" height="50" src="/fig/mod3.png">
</p>

```{r}
H <- EnvKernel(env.data = Env.data,Y = Y,merge = T,env.id = 'env',bydiag=FALSE)
dim(H)
dim(H$varCov) # variable relationship
dim(H$envCov) # environmental relationship
superheat(H$envCov,row.dendrogram = T,col.dendrogram = T)
  • Parametrization by

resulting in diag(K_W) = 1

H <- EnvKernel(env.data = Env.data,Y = Y,merge = T,env.id = 'env',bydiag=TRUE)
dim(H)
dim(H$varCov) # variable relationship
dim(H$envCov) # environmental relationship
superheat(H$envCov,row.dendrogram = T,col.dendrogram = T)
 ```

> * Gaussian parametrization by 

<p align="center">
<img width="130" height="50" src="/fig/mod5.png">
</p>

which d = dist(W), q = median(d) and h = gaussian parameter (default = 1)

```{r}
H <- EnvKernel(env.data = Env.data,Y = Y,merge = T,env.id = 'env',gaussian=TRUE)
dim(H)
dim(H$varCov) # variable relationship
dim(H$envCov) # environmental relationship
superheat(H$envCov,row.dendrogram = T,col.dendrogram = T)

________________

Attention:\ K_G = list of genomic kernels;\ K_E = list of environmental kernels;\ reaction = TRUE, build the haddamard's product between genomic and envirotype-based kernels;\ reaction = FALSE, but K_E != NULL, only random environmental effects using K_E are incorporated in the model

________________

EMM <-get_kernel(K_G = list(G=G),K_E = list(W=H$envCov), Y = Y,model = 'EMM') 

EMDs <-get_kernel(K_G = list(G=G),Y = Y,K_E = list(W=H$envCov),model = 'EMDs') # or model = MDs

RN <-get_kernel(K_G = list(G=G),K_E = list(W=H$envCov), Y = Y,model = 'RNMM')

fullRN <-get_kernel(K_G = list(G=G),K_E = list(W=H$envCov), Y = Y,model = 'RNMDs')

Env.data<-W.matrix(env.data = df.clim,by.interval = T,statistic = 'quantile',
                time.window = c(0,14,35,60,90,120))

W <- EnvKernel(env.data = Env.data,Y = Y,merge = T,env.id = 'env',bydiag=TRUE)

# by using size_E = 'environment', get_kernel directly takes a W of q x q environments and builds a n x n matrix as EnvKernel()
EMM <-get_kernel(K_G = list(G=G),K_E = list(W=W$envCov), Y = Y,,model = 'EMM',size_E = 'environment')


# Its possible to integrate more than one environmental kernel
T.cov<- EnvTyping(env.data=df.clim,var.id =  c('T2M','PRECTOT','WS2M'),env.id='env',format = 'wide')
eT <- EnvKernel(env.data =T.cov,Y = Y,merge = T,env.id = 'env',bydiag=TRUE)


EMM <-get_kernel(K_G = list(G=G),K_E = list(W=W$envCov,eT=eT$envCov), Y = Y,model = 'EMM',size_E = 'environment')
EMM$KE_W # kernel from W
EMM$KE_eT # kernel from T (envirotype)

require(BGGE)

 ne <- as.vector(table(maizeYield$env))
      fit <- BGGE(y = maizeYield$value,
                  K = EMM,
                  ne = ne,
                  ite = 1000,
                  burn = 100,
                  thin = 2,
                  verbose = TRUE)


allogamous/EnvRtype documentation built on Nov. 1, 2024, 3:48 a.m.