Learn R Programming

decorrelate (version 0.1.6.4)

reform_decomp: Recompute eclairs after dropping features

Description

Recompute eclairs after dropping features

Usage

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

Value

eclairs decomposition for a subset of features

Arguments

ecl

covariance/correlation matrix as an eclairs object

k

the rank of the low rank component

drop

array of variable names to drop.

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

Run this code
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

Run the code above in your browser using DataLab