pca.elbow: Visualize the percent variance explained by PCs

Description Usage Arguments Details Value Author(s) Examples

Description

Plot the classic elbow plot, showing the percent variance explained by PCs.

Usage

1
2
3
4
5
6
7
8
pca.elbow(
  dat,
  center.dat = TRUE,
  scale.dat = FALSE,
  r = NULL,
  pt.size = 1,
  title = ""
)

Arguments

dat

a data matrix with m biomarkers as rows, over n time points (columns).

center.dat

a logical specifying to center the data. By default, TRUE.

scale.dat

a logical specifying to scale the data. By default, FALSE.

r

the top r PCs to display. by default, showing all PCs.

pt.size

the size of data points.

title

the title for the resulting plot.

Details

The input data is either centered and/or scaled. SVD/PCA is computed and the percent variacnes explained by the top r PCs are plotted. If the denoising step is used, please input the denoised data.

Value

pca.elbow returns a ggplot2 object.

Author(s)

Neo Christopher Chung nchchung@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
data(cys_optm)
meta <- cys_optm[,1:4]
optm <- log(cys_optm[meta$Select,5:10])
optm <- t(scale(t(optm), scale=TRUE, center=TRUE))
days <- as.numeric(colnames(optm))

pca.elbow(dat=optm,
center.dat=TRUE,
scale.dat=FALSE,
title="Percent variance explained by 10 PCs")

## End(Not run)

UCLA-BD2K/CV.Signature.TCP documentation built on May 15, 2020, 11:27 p.m.