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

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

if (FALSE) {
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)))
}