crossVal(gpData, trait=1, cov.matrix = NULL, k = 2, Rep = 1, Seed = NULL,
sampling = c("random", "within popStruc", "across popStruc","commit"),
TS=NULL,ES=NULL, varComp = NULL, popStruc = NULL, VC.est = c("commit",
"ASReml","BRR","BL"),verbose=FALSE,...)
gpData
numeric
or character
. The name or number of the trait in the gpData
object to be used as trait.
list
including covariance matrices for the random effects. Size and order of rows and columns should be equal to rownames of y
.
If no covariance is given, an identity matrix and marker genotypes are used for a marker regression. In general, a covariance matrix should be non-singular and positive definite to be invertible, if this is not the case, a constant of 1e-5
is added to the diagonal elements of the covariance matrix.
numeric
. Number of folds for k-fold cross validation, thus k
should be in [2,nrow(y)
] (default=2).
numeric
. Number of replications (default = 1).
numeric
. Number for set.seed()
to make results reproducable.
"random"
, "within popStruc"
or "across popStruc"
. If sampling is "commit"
test sets have to specified in TS (see Details).
id.TS
.
vector
of variance components for the random effects, which has to be specified if VC.est="commit"
. The first variance components should be
the same order as the given covariance matrices, the last given variance component is for the residuals.
nrow(y)
assigning individuals to a population structure. If no popStruc
is defined, family information of gpData
is used. Only required for options sampling="within popStruc"
or sampling="across popStruc"
ASReml
" or with Bayesian Ridge Regression "BRR
" or Bayesian Lasso "BL
" of the BLR
package within the estimation set of each fold in the cross validation? If
VC.est="commit"
, the variance components have to be defined in varComp
. For ASReml
, ASReml software has to be installed on the system.
BLR
function (see BLR
).
list
with following items:
set.seed()
committed
or reestimated with ASReml/BRR/BL
)sampling
can be defined as:
VC.est="commit"
: $$\bf y=\bf{Xb}+\bf{Zu}+\bf e$$ with $$\bf u \sim N(0,G\sigma^2_u)$$
gives the mixed model equations
$$\left(\begin{array}{cc} \bf X'\bf X & \bf X'\bf Z \\ \bf Z'\bf X & \bf Z'\bf Z + \bf G^{-1}\frac{\sigma^2_e}{\sigma^2_u} \end{array} \right) \left( \begin{array}{c} \bf b \\ \bf u \end{array}\right) = \left(\begin{array}{c}\bf X'\bf y \\ \bf Z'\bf y \end{array} \right)$$summary.cvData
# loading the maize data set
## Not run: ------------------------------------
# library(synbreedData)
# data(maize)
# maize2 <- codeGeno(maize)
# U <- kin(maize2,ret="realized")
# # cross validation
# cv.maize <- crossVal(maize2,cov.matrix=list(U),k=5,Rep=1,
# Seed=123,sampling="random",varComp=c(26.5282,48.5785),VC.est="commit")
# cv.maize2 <- crossVal(maize2,k=5,Rep=1,
# Seed=123,sampling="random",varComp=c(0.0704447,48.5785),VC.est="commit")
# # comparing results, both are equal!
# cv.maize$PredAbi
# cv.maize2$PredAbi
# summary(cv.maize)
# summary(cv.maize2)
## ---------------------------------------------
Run the code above in your browser using DataLab