get_pct_var_exp_svd: Compute percent of variance explained

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Compute percent of variance explained

Usage

1
get_pct_var_exp_svd(thissvd, preproc_mat = thissvd$d)

Arguments

thissvd

list outputted from an svd function (svd, irlba; can also take output from corral_mat and corralm_matlist)

preproc_mat

matrix of pre-processed values (optional) - important to include if the svd is only partial as this is used to compute the sum of eigenvalues

Value

vector of percent variance explained values, indexed by PC

Examples

1
2
3
4
5
mat <- matrix(sample(seq(0,20,1),100,replace = TRUE),nrow = 10)
my_svd <- svd(mat)
get_pct_var_exp_svd(my_svd) # this works if my_svd is a full svd
my_irl <- irlba::irlba(mat,nv = 2)
get_pct_var_exp_svd(my_irl, preproc_mat = mat) # ... otherwise use this 

corral documentation built on Nov. 8, 2020, 8:25 p.m.