covestEB: Estimating Covariance Matrix using Empirical Bayes

Description Usage Arguments Details Value Examples

View source: R/ultility.R

Description

Estimating covariance matrix using Empirical Bayes

Usage

1
2
3
covestEB(X, estpi0 = FALSE, order = -3, verbose = FALSE, force.nonbin = FALSE)

covestEB.cor(X, verbose = FALSE)

Arguments

X

a matrix of size n * p, where n is the number of observations and p is the number of variables

estpi0

logical; if TRUE, the NPMLE is estimated based on the estimation of pi0, which in this case can be used to detect sparsity or assume sparsity.

order

the level of binning to use when the number of observations passed to the computation is greater than 5000.

verbose

logical; If TRUE, the intermediate results will be shown.

force.nonbin

logical; If TRUE, no binning is performce by force.

Details

The function covestEB performs covariance matrix estimation using Fisher transformation, while the function covestEB.cor performs covariance estimation directly on sample correlation coefficients using one-parameter normal approximation.

Covariance matrix estimation using Fisher transformation supports estimation sparsity as well as large-scale computation, while estimation on the original scale supports neither and it is for comparison only. It is recommended to perform estimation on Fisher-transformed sample correlation coefficients.

Value

a list. a covariance matrix estimate of size p * p is given in mat, whether correction is done is given in correction, and the method for computing the density of sample correlation coefficients is given in method.

Examples

1
2
3
4
n = 100; p = 50
X = matrix(rnorm(n * p), nrow = n, ncol = p)
r = covestEB(X)
r2 = covestEB.cor(X)

xiangjiexue/npfixedcompR documentation built on Jan. 1, 2021, 11:39 p.m.