apply_pca: Data dimensionality reduction using PCA on a split object.

View source: R/apply_PCA.R

apply_pcaR Documentation

Data dimensionality reduction using PCA on a split object.

Description

Fit PCA on the training set and apply the same transformation to the test set. The goal is to use principal components in prediction models as a smaller number of variables instead of all the marker predictors.

Usage

apply_pca(split, geno, threshold = 0.95, ...)

Arguments

split

An object of class split, corresponding to one element of the total cv_object generated by one of the functions predict_cv0(), predict_cv00(), predict_cv1(), or predict_cv2(), and containing the following items:

  • training: data.frame Training dataset

  • test: data.frame Test dataset

geno

data.frame It corresponds to a geno element within an object of class METData.

threshold

numeric A fraction of the total variance that should be covered by the components

Value

pc_values A data.frame containing the principal components in columns and the names of all lines used in the study is contained in the first column 'geno_ID'. PCs for the lines present in the test set were computed based on the transformation done on the training set.

Author(s)

Cathy C. Westhues cathy.jubin@hotmail.com


cjubin/learnMET documentation built on Nov. 4, 2024, 6:23 p.m.