cov_ed: Perform "extreme deconvolution" (Bovy et al) on a subset of...

View source: R/data2cov.R

cov_edR Documentation

Perform "extreme deconvolution" (Bovy et al) on a subset of the data

Description

Perform "extreme deconvolution" (Bovy et al) on a subset of the data

Usage

cov_ed(data, Ulist_init, subset = NULL, algorithm = c("bovy", "teem"), ...)

Arguments

data

a mash data object

Ulist_init

a named list of covariance matrices to use to initialize ED; default is to use matrices from PCs

subset

a subset of data to be used when ED is run (set to NULL for all the data)

algorithm

algorithm to run ED

...

other arguments to be passed to ED algorith, see extreme_deconvolution for algorithm 'bovy', or teem_wrapper for algorithm 'teem'

Details

Runs the extreme deconvolution algorithm from Bovy et al (Annals of Applied Statistics) to estimate data-driven covariance matrices. It can be initialized with, for example running cov_pca with, say, 5 PCs.

Examples

## Not run: 
data = mash_set_data(Bhat = cbind(c(1,2),c(3,4)), Shat = cbind(c(1,1),c(1,1)))
U_pca = cov_pca(data,2)
U_x = apply(data$Bhat, 2, function(x) x - mean(x))
U_xx = t(U_x) %*% U_x / nrow(U_x)
cov_ed(data,c(U_pca, list(xx = U_xx)))

## End(Not run)


mashr documentation built on Oct. 18, 2023, 5:08 p.m.