Compute mr.mash-RSS TWAS weights from summary statistics
Source:R/regularized_regression.R
mrmash_rss_weights.RdMulti-context summary-statistics analog of mrmash_weights:
extracts coefficients from an existing mr.mashr::mr.mash.rss fit,
or fits one from stat (variants x conditions) and LD.
Usage
mrmash_rss_weights(
stat,
LD,
mrmash_rss_fit = NULL,
data_driven_prior_matrices = NULL,
canonical_prior_matrices = TRUE,
S0 = NULL,
w0 = NULL,
V = NULL,
covY = NULL,
retain_fit = FALSE,
...
)Arguments
- stat
A list with
z(variants x conditions matrix) andn(per-context numeric vector or scalar). May also includeBhat,Shatmatrices.- LD
LD correlation matrix.
- mrmash_rss_fit
Optional pre-fitted
mr.mash.rssobject; skips fitting when supplied.- data_driven_prior_matrices
Optional list with element
U(list of raw covariance matrices). Passed directly tomr.mashr::expand_covs()alongside the canonical mixture.- canonical_prior_matrices
Logical. When TRUE (default), include the standard canonical mixture from
mr.mashr::compute_canonical_covs(). When FALSE,data_driven_prior_matricesmust be supplied.- S0
Optional pre-built list of prior covariance matrices, bypassing the canonical / data-driven construction.
- w0
Optional prior mixture weights; defaults to
compute_w0(Bhat, length(S0)).- V
Optional residual covariance matrix (K x K). When NULL, defaults to the identity matrix of size K.
- covY
Optional response covariance matrix (K x K). When NULL, defaults to the identity matrix of size K.
- retain_fit
If TRUE, attaches the fitted object as the
"fit"attribute on the returned weights.- ...
Additional arguments forwarded to
mr.mashr::mr.mash.rss.
Details
Follows the *_rss_weights(stat, LD, ...) contract. Expects
stat$z to be a numeric matrix (variants x conditions) and
stat$n a per-context numeric vector or scalar. stat$Bhat
and stat$Shat are used if present; otherwise derived from Z and
n.
Prior construction reuses the same infrastructure as the individual-level
mrmash_wrapper: compute_grid +
mr.mashr::compute_canonical_covs() +
mr.mashr::expand_covs() for S0, and
compute_w0 for the mixture weights. Supply
data_driven_prior_matrices (e.g. from
compute_cov_flash / compute_cov_diag) to add
data-driven covariance components alongside the canonical mixture.