Estimate mash Prior Covariances and Mixture Weights
Source:R/mashPipeline.R
mashPriorCovariances.RdBuild the mash prior covariance list U and mixture weights
w from a {strong[, random, null]} SumStats collection. Split
out of mashPipeline so the covariance-estimation chain lives in
one place. The default builds every non-udr covariance component
(canonical + pca + flash + flash_nonneg) and refines them with mashr
extreme deconvolution (cov_ed).
Arguments
- sumStatsList
Named list (or
S4Vectors::SimpleList) with at least"strong"(the discovery set the covariances are learned on).- alpha
mash
alpha.- vhat
Residual correlation matrix (
V); typically frommashResidualCorrelation.NULL-> identity.- components
Data-driven covariance components, any of
"canonical","pca","flash"(defaultcov_flash),"flash_nonneg"(cov_flash(factors = "nonneg")). Built in that fixed order. Ignored by the"ud"/"ud_ted"engines.- engine
Covariance-refinement engine.
"cov_ed"(default; mashr's exportedcov_ed()extreme deconvolution, whose defaultalgorithm = "bovy"IS the Bovy et al. 2011 method – weights from a finalmash());"ud"/"ud_ted"(udr ED / TED updates, returning weights directly – OPT-IN, known numerical issues, so not the default;"ud_ted"additionally needs i.i.d. (z-scale) data).- nPcs
PCs seeded into
cov_pca. Defaultncol(Bhat) - 1.- priorCovariances
Optional caller-supplied prior
U: a non-empty named list ofnCond x nCondmatrices. When supplied, the covariance chain is bypassed and only the mixture-weight fit runs.- priorComponents
Optional caller-supplied raw covariance components (a non-empty named list, e.g. the concatenated
mashCovarianceComponentsoutputs). When supplied, these are refined byengineinstead of being rebuilt internally – the mixture-prior pipeline where separate steps built the components.components/nPcsare then ignored. Distinct frompriorCovariances, which bypasses the engine entirely.- udControl
Named list overriding the udr controls for the
"ud"/"ud_ted"engines:n_unconstrained(data-driven matrices to fit; default 50 – the dominant cost, so reduce it for few-condition data),maxiter(default 1000),tol,tol.lik. Ignored bycov_ed.- inputScale
SumStats -> matrix conversion scale.
- setSeed
Integer seed, or
NULLto leave the ambient RNG untouched.
Value
list(U, w, loglik): the covariance list, the
mashr::get_estimated_pi() mixture weights, and the fit
log-likelihood (NULL for the cov_ed engine).