eclairs | R Documentation |
Estimate the covariance/correlation between columns as the weighted sum of a low rank matrix and a scaled identity matrix. The weight acts to shrink the sample correlation matrix towards the identity matrix or the sample covariance matrix towards a scaled identity matrix with constant variance. An estimate of this form is useful because it is fast, and enables fast operations downstream. The method is based on the Gaussian Inverse Wishart Empirical Bayes (GIW-EB) model.
eclairs(
X,
k,
lambda = NULL,
compute = c("covariance", "correlation"),
n.samples = nrow(X)
)
X |
data matrix with n samples as rows and p features as columns |
k |
the rank of the low rank component |
lambda |
shrinkage parameter. If not specified, it is estimated from the data. |
compute |
evaluate either the |
n.samples |
number of samples data is from. Usually |
Compute U
, d^2
to approximate the correlation matrix between columns of data matrix X by U diag(d^2 (1-\lambda)) U^T + I\nu\lambda
. When computing the covariance matrix, scale by the standard deviation of each feature.
eclairs object storing:
orthonormal matrix with k columns representing the low rank component
eigen-values so that U diag(d^2) U^T
is the low rank component
shrinkage parameter \lambda
for the scaled diagonal component
standard deviations of input columns
diagonal value, \nu
, of target matrix in shrinkage
number of samples (i.e. rows) in the original data
number of features (i.e. columns) in the original data
rank of low rank component
sample names from the original matrix
features names from the original matrix
method used for decomposition
the function call
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))
# eclairs decomposition: covariance
ecl <- eclairs(Y, compute = "covariance")
ecl
# eclairs decomposition: correlation
ecl <- eclairs(Y, compute = "correlation")
ecl
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.