findPC: findPC

View source: R/findPC.R

findPCR Documentation

findPC

Description

Automatic selection of number of principal components

Usage

findPC(
  sdev,
  number = 30,
  method = "perpendicular line",
  aggregate = NULL,
  figure = FALSE
)

Arguments

sdev

A vector of the standard deviations explained by each principal component

number

A vector including number of PCs used in the function (default is 30)

method

Methods include 'all', 'piecewise linear model', 'first derivative', 'second derivative', 'preceding residual', 'perpendicular line (default)', 'k-means clustering'

aggregate

An option to report the mean, median, or voting (median if all are different, otherwise mode) of the results

figure

Whether to draw a heatmap showing the results

Details

findPC returns a list of results for one or multiple methods with different total numbers of PCs. It also supports the aggregation of results from multiple methods and total numbers of PCs by taking the average, median, or mode. For users who want to visually inspect the results, findPC can also display the elbow plot with the automatically identified elbow points.

Value

A numeric value (matrix) including the number of PCs.

Author(s)

Haotian Zhuang, Zhicheng Ji haotian.zhuang@duke.edu

Examples

Return the default result (Perpendicular line with 30 PCs)
findPC(sdev = sdev)

Return the results based on Piecewise linear model with 24,36 and 48 PCs
findPC(sdev = sdev,number = c(24,36,48),method = 'piecewise linear model')

Return the results based on six methods with 24,36 and 48 PCs
findPC(sdev = sdev,number = c(24,36,48),method = 'all')

Return voting (median if all are different, otherwise mode) of the results from six methods with 24,36 and 48 PCs
findPC(sdev = sdev,number = c(24,36,48),method = 'all',aggregate = 'voting')

Return a heatmap based on six methods with 24,36 and 48 PCs
findPC(sdev = sdev,number = c(24,36,48),method = 'all',figure = T)

haotian-zhuang/findPC documentation built on July 1, 2022, 10:42 a.m.