stackTrait {lme4breeding} | R Documentation |
Stacking traits in a dataset
Description
stackTrait
creates a dataset stacking traits in the long format to be used with the lmebreed
solver for multi-trait models.
Usage
stackTrait(data, traits)
Arguments
data |
a data frame with traits in wide format. |
traits |
variable names corresponding to the traits that should be in the long format. |
Value
- $res
a data frame with traits in long format.
Author(s)
Giovanny Covarrubias-Pazaran
References
Giovanny Covarrubias-Pazaran (2024). lme4breeding: enabling genetic evaluation in the age of genomic data. To be submitted to Bioinformatics.
Douglas Bates, Martin Maechler, Ben Bolker, Steve Walker (2015). Fitting Linear Mixed-Effects Models Using lme4. Journal of Statistical Software, 67(1), 1-48.
See Also
The function for the lmebreed
solver.
Examples
data(DT_cpdata)
DT <- DT_cpdata
GT <- GT_cpdata
MP <- MP_cpdata
## create the variance-covariance matrix
A <- A.mat(GT) # additive relationship matrix
A <- A + diag(1e-4, ncol(A), ncol(A))
## look at the data and fit the model
head(DT)
DT2 <- stackTrait(data=DT, traits = c("Yield","color"))
head(DT2$long)
mix1 <- lmebreed(valueS~ (0+trait|id),
relmat=list(id=A),
control = lmerControl(
check.nobs.vs.nlev = "ignore",
check.nobs.vs.rankZ = "ignore",
check.nobs.vs.nRE="ignore"
),
data=DT2$long)
vc <- VarCorr(mix1); print(vc,comp=c("Variance"))
cov2cor(vc$id)
[Package lme4breeding version 1.0.30 Index]