cv {predhy} | R Documentation |
Evaluate Trait Predictability via Cross Validation
Description
The cv function evaluates trait predictability based on eight GS methods via k-fold cross validation. The trait predictability is defined as the squared Pearson correlation coefficient between the observed and the predicted trait values.
Usage
cv(
fix = NULL,
gena,
gend = NULL,
parent_phe = NULL,
hybrid_phe,
method = "GBLUP",
drawplot = TRUE,
nfold = 5,
nTimes = 1,
seed = 1234,
CPU = 1
)
Arguments
fix |
a design matrix of the fixed effects. |
gena |
a matrix (n x m) of additive genotypes for the training population. |
gend |
a matrix (n x m) of domiance genotypes for the training population. Default is NULL. |
parent_phe |
a matrix of a phenotypic values of parent.The names parent_phe must match the rownames of inbred_gen. Default is NULL. |
hybrid_phe |
a data frame with three columns. The first column and the second column are the names of male and female parents of the corresponding hybrids, respectively; the third column is the phenotypic values of hybrids. The names of male and female parents must match the rownames of inbred_gen. Missing (NA) values are not allowed. |
method |
eight GS methods including "GBLUP", "BayesB", "RKHS", "PLS", "LASSO", "EN", "XGBoost","LightGBM". Users may select one of these methods or all of them simultaneously with "ALL". Default is "GBLUP". |
drawplot |
when method ="ALL", user may select TRUE for a barplot about eight GS methods. Default is TRUE. |
nfold |
the number of folds. Default is 5. |
nTimes |
the number of independent replicates for the cross-validation. Default is 1. |
seed |
the random number. Default is 1234. |
CPU |
the number of CPU. |
Value
Trait predictability
Examples
## load example data from predhy package
data(hybrid_phe)
data(input_geno)
## convert original genotype
inbred_gen <- convertgen(input_geno, type = "hmp2")
##additive model infer the additive and dominance genotypes of hybrids
gena <- infergen(inbred_gen, hybrid_phe)$add
gend <- infergen(inbred_gen, hybrid_phe)$dom
##additive model
R2<-cv(fix=NULL,gena,gend=NULL,parent_phe=NULL,hybrid_phe,method ="GBLUP")
##additive-dominance model
R2<-cv(fix=NULL,gena,gend,parent_phe=NULL,hybrid_phe,method ="GBLUP")