cv_fast: Evaluate Trait Predictability via the HAT Method

View source: R/cv_fast.R

cv_fastR Documentation

Evaluate Trait Predictability via the HAT Method

Description

The HAT method is a fast algorithm for the ordinary cross validation. It is highly recommended for large dataset (Xu et al. 2017).

Usage

cv_fast(fix = NULL, y, kk, nfold = 5, seed = 123)

Arguments

fix

a design matrix of the fixed effects. If not passed, a vector of ones is added for the intercept.

y

a vector of the phenotypic values.

kk

a list of one or multiple kinship matrices.

nfold

the number of folds, default is 5. For the HAT Method, nfold can be set as the sample size (leave-one-out CV) to avoid variation caused by random partitioning of the samples, but it is not recommended for cv.

seed

the random number, default is 123.

Value

Trait predictability

References

Xu S. (2017) Predicted residual error sum of squares of mixed models: an application for genomic prediction. G3 (Bethesda) 7, 895-909.

Examples


## load example data from hypred package
data(hybrid_phe)
data(input_geno)

## convert original genotype
inbred_gen <- convertgen(input_geno, type = "hmp2")

## infer the additive and dominance genotypes of hybrids
gena <- infergen(inbred_gen, hybrid_phe)$add
gend <- infergen(inbred_gen, hybrid_phe)$dom

## calculate the additive and dominance kinship matrix
ka <- kin(gena)
kd <- kin(gend)

##for the additive model
predictability <- cv_fast(y = hybrid_phe[,3], kk = list(ka))

##for the additive-dominance model
predictability <- cv_fast(y = hybrid_phe[,3], kk = list(ka,kd))



predhy documentation built on Nov. 10, 2022, 6:13 p.m.

Related to cv_fast in predhy...