sparse_pca: Perform sparse pca on a matrix

Description Usage Arguments Value Examples

View source: R/sparse_pca.R

Description

sparse_pca() performs a fast pca on a matrix while maintaining sparsity.

Usage

1
sparse_pca(x, n_pcs, mu = NULL, s = NULL, center_scale = TRUE)

Arguments

x

a matrix of values to perform dimensionality reduction on; by default, rows are genes and columns are cells

n_pcs

number of prinicpal components to compute

mu

column means

s

column standard deviations

center_scale

perform centering and scaling

Value

A list containing "x" - The rotated data matrix where rows are barcodes and columns are PCs "sdev" - the standard deviations of the principal components (i.e., sqrt of eigvals of the covariance matrix) "rotation" - The loadings (eigenvectors) where each column is a PC "tot_var" - The total variation in the scaled and centered matrix (this is also the effective rank of the matrix) "var_pcs" - The proportion of variance explained by each principle comoponent

Examples

1
sparse_pca(mtx, n_pcs=10)

jacobheng/cellwrangler documentation built on Aug. 12, 2019, 6:49 a.m.