Skip to contents

Estimate shrinkage parameter by empirical Bayes

Usage

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

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.

Value

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

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

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)
#>       lambda    logLik nu
#> 1 0.02652135 -117651.2  1

# For truncated SVD at k = 20
getShrinkageParams(ecl, k = 20)
#>      lambda    logLik       nu
#> 1 0.4481936 -190888.6 1.250719