bivariateRun: bivariateRun functionality

View source: R/FUN_special.R

bivariateRunR Documentation

bivariateRun functionality

Description

Sometimes multi-trait models can present many singularities making the model hard to estimate with many traits. One of the most effective strategies is to estimate all possible variance and covariances splitting in multiple bivariate models. This function takes a model that has t traits and splits the model in as many bivariate models as needed to estimate all the variance and covariances to provide the initial values for the model with all traits.

Usage

  bivariateRun(model, n.core)

Arguments

model

a model fitted with the mmer function with argument return.param=TRUE.

n.core

number of cores to use in the mclapply function to parallelize the models to be run to avoid increase in computational time. Please keep in mind that this is only available in Linux and macOS systems. Please check the details in the mclapply documentation of the parallel package.

Value

$sigmas

the list with the variance covariance parameters for all traits together.

$sigmascor

the list with the correlation for the variance components for all traits together.

$model

the results from the bivariate models.

Author(s)

Giovanny Covarrubias-Pazaran

References

Covarrubias-Pazaran G (2016) Genome assisted prediction of quantitative traits using the R package sommer. PLoS ONE 11(6): doi:10.1371/journal.pone.0156744

See Also

The core function of the package mmer

Examples


# ####=========================================####
# ####=========================================####
# #### EXAMPLE 1
# #### simple example with univariate models
# ####=========================================####
# ####=========================================####
# data("DT_cpdata")
# DT <- DT_cpdata
# GT <- GT_cpdata
# MP <- MP_cpdata
# #### create the variance-covariance matrix
# A <- A.mat(GT)
# #### look at the data and fit the model
# head(DT)
# ans.m <- mmer(cbind(Yield,color,FruitAver, Firmness)~1,
#                random=~ vsr(id, Gu=A, Gtc=unsm(4))
#                + vsr(Rowf,Gtc=diag(4))
#                + vsr(Colf,Gtc=diag(4)), na.method.Y="include",
#                rcov=~ vsr(units,Gtc=unsm(4)), return.param = TRUE,
#                data=DT)
# 
# # define the number of cores (number of bivariate models) as (nt*(nt-1))/2 
# nt=4
# (nt*(nt-1))/2
# res <- bivariateRun(ans.m,n.core = 6)
# # now use the variance componets to fit a join model
# mm <- transformConstraints(ans.m[[8]],3)
# 
# ans.m.final <- mmer(cbind(Yield,color,FruitAver, Firmness)~1,
#               random=~ vsr(id, Gu=A, Gtc=unsm(4))
#               + vsr(Rowf,Gtc=diag(4))
#               + vsr(Colf,Gtc=diag(4)), na.method.Y="include",
#               rcov=~ vsr(units,Gtc=unsm(4)), 
#               init = res$sigmas_scaled, constraints = mm,
#               data=DT, iters=1)
# 
# summary(ans.m.final)


sommer documentation built on Nov. 13, 2023, 9:05 a.m.