get_pct_var_exp_svd: Compute percent of variance explained

View source: R/utils.R

get_pct_var_exp_svdR Documentation

Compute percent of variance explained

Description

Compute percent of variance explained

Usage

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

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 

laurenhsu1/corral documentation built on Feb. 19, 2023, 10:37 p.m.