STATegRa (version 1.6.2)

PCA.selection: Select an optimal number of components using PCA

Description

Selects the optimal number of components from data using PCA. There are four different criteria available: accumulated variance explained, individual explained variance of each component, absolute value of variability or fixed number of components.

Usage

PCA.selection(Data, fac.sel, varthreshold=NULL, nvar=NULL, PCnum=NULL)

Arguments

Data
Data matrix (with samples in columns and features in rows)
fac.sel
Selection criteria ("%accum", "single%", "rel.abs", "fixed.num")
varthreshold
Threshold for "%accum" or "single%" criteria
nvar
Threshold for "rel.abs"
PCnum
Fixed number of components for "fixed.num"

Value

List containing:
PCAres
List containing results of PCA, with fields "eigen", "var.exp", "scores" and "loadings"
numComps
Number of components selected

Examples

Run this code
data(STATegRa_S3)
ps <- PCA.selection(Data=Block2.PCA, fac.sel="single%", varthreshold=0.03)
ps$numComps

Run the code above in your browser using DataCamp Workspace