cv | R Documentation |
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.
cv( fix = NULL, gena, gend = NULL, y, method = "GBLUP", drawplot = TRUE, nfold = 5, nTimes = 1, seed = 1234, CPU = 1 )
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. |
y |
a vector(n x 1) of the phenotypic values. |
method |
eight GS methods including "GBLUP", "BayesB", "RKHS", "PLS", "LASSO", "EN", "XGBOOST", "RF". 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. |
Trait predictability
## load example data from hypred 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,y=hybrid_phe[,3],method ="GBLUP",nfold=5,nTimes=1,seed=1234,CPU=1) ##additive-dominance model R2<-cv(fix=NULL,gena,gend,y=hybrid_phe[,3],method ="GBLUP",nfold=5,nTimes=1,seed=1234,CPU=1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.