cross_val: Run cross-validation of a training set

View source: R/cross_validation.R

cross_valR Documentation

Run cross-validation of a training set

Description

Perform cross-validation using a training set of genotypic and phenotypic data. The function will perform cross-validation using a single vector of phenotypes (i.e. from a single environment or a single trait). This procedure is useful to get an idea of the accuracy of genomic prediction for different scenarios.

Usage

cross_val(
  phenotypes,
  genotypes,
  cv.method = c("fractional", "k-fold"),
  frac.train = 0.6,
  frac.reps = 250,
  folds = 10,
  fold.reps = 25
)

Arguments

phenotypes

A n x t matrix of phenotypes where n is the number of lines/entries and t is the number of traits. Row names should be entry/line names and column names should be trait names. The function assumes that the order of the entry/lines names is the same as in the genotype matrix. No missing data allowed.

genotypes

A n x m matrix of genotypic data where n is the number of lines/entries and m is the number of biallelic markers. Column names should be marker names and row names should be entry/line names. The matrix should be coded in 1, 0, -1, where 1 is homozygous for the first allele, 0 is heterzygous, and -1 is homozygous for the second allele. The order of lines/entries should match that of the phenotypes matrix. No missing data allowed.

cv.method

The method of cross-validation. Choices are "fractional" or "k-fold". See Details for a description of these methods. Defaults to both.

frac.train

The proportion of the data to use as the training set when running "fractional" cross-validation. In each repetition,


neyhartj/gws documentation built on Feb. 5, 2024, 12:42 a.m.