Skip to contents

This function is used to calculate predictive powers of different models at different thresholds.

Usage

Prediction_cross_validation(
  rds.obj,
  k,
  threshold = 1,
  method = "GWAS",
  liabilities = rds.obj$FAM$Status
)

Arguments

rds.obj

A .rds file with an FBM.code256 and accompanying FAM and MAP tibbles.

k

Number of folds to be used in cross-validation. The number of rows in the FBM must be at least twice as large as k. Highly recommended to choose k to be at most ~1% of the number of rows, unless working with a very small dataset, as errors may occur.

threshold

Vector of significance levels to be used in thresholding. Default does not use thresholding.

method

Method to use for prediction. Possible methods are "GWAS", "GWAX", "LTFH". Default is "GWAS".

liabilities

Vector of liabilities used for prediction with "LTFH" method. If not specified, uses "GWAS" method instead.

Value

A list with 2 entries: a tibble with average and best scores for each threshold, and a data.frame with the best model, fitted values, residuals, best P-value and its R^2.