Learn R Programming

decorrelate (version 0.1.6.3)

getShrinkageParams: Estimate shrinkage parameter by empirical Bayes

Description

Estimate shrinkage parameter by empirical Bayes

Usage

getShrinkageParams(ecl, k = ecl$k, minimum = 1e-04, lambda = NULL)

Value

value \(\lambda\) and \(\nu\) indicating the shrinkage between sample and prior covariance matrices.

Arguments

ecl

eclairs() decomposition

k

number of singular vectors to use

minimum

minimum value of lambda

lambda

(default: NULL) If NULL, estimate lambda from data. Else evaluate logML using specified lambda value.

Details

Estimate shrinkage parameter for covariance matrix estimation using empirical Bayes method (Hannart and Naveau, 2014; Leday and Richardson 2019). The shrinage estimate of the covariance matrix is \((1-\lambda)\hat\Sigma + \lambda \nu I\), where \(\hat\Sigma\) is the sample covariance matrix, given a value of \(\lambda\). A large value of \(\lambda\) indicates more weight on the prior.

References

Hannart, A., & Naveau, P. (2014). Estimating high dimensional covariance matrices: A new look at the Gaussian conjugate framework. Journal of Multivariate Analysis, 131, 149-162.

Leday, G. G., & Richardson, S. (2019). Fast Bayesian inference in large Gaussian graphical models. Biometrics, 75(4), 1288-1298.

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))

# eclairs decomposition: covariance
ecl <- eclairs(Y, compute = "correlation")

# For full SVD
getShrinkageParams(ecl)

# For truncated SVD at k = 20
getShrinkageParams(ecl, k = 20)

Run the code above in your browser using DataLab