Skip to contents

Recompute eclairs after dropping features

Usage

reform_decomp(ecl, k = ecl$k, drop = NULL)

Arguments

ecl

covariance/correlation matrix as an eclairs object

k

the rank of the low rank component

drop

array of variable names to drop.

Value

eclairs decomposition for a subset of features

Details

Reform the dataset from the eclairs decomposition, drop features, then recompute the eclairs decomposition. If the original SVD/eigen was truncated, then the reconstruction of the original data will be approximate. Note that the target shrinkage matrix is the same as in ecl, so \(\nu\) is not recomputed from the retained features.

Examples

library(Rfast)

n <- 800 # number of samples
p <- 200 # number of features

# create correlation matrix
Sigma <- autocorr.mat(p, .9)

# draw data from correlation matrix Sigma
Y <- rmvnorm(n, rep(0, p), sigma = Sigma * 5.1, seed = 1)
rownames(Y) <- paste0("sample_", seq(n))
colnames(Y) <- paste0("gene_", seq(p))

# Correlation
#------------

# eclairs decomposition
Sigma.eclairs <- eclairs(Y, compute = "correlation")

# features to drop
drop <- paste0("gene_", 1:100)

# Compute SVD on subset of eclairs decomposition
ecl1 <- reform_decomp(Sigma.eclairs, drop = drop)

ecl1
#>        Estimate correlation with low rank and shrinkage
#> 
#>   Original data dims: 800 x 100 
#>   Low rank component: 100 
#>   lambda:             0.0144 
#>   nu:                 1 
#>   Avg corr (EB):      0.16 
#>   Avg corrSq (EB):    0.0807 
#>   logLik:             -55420