Compute mr.mash-RSS TWAS weights from summary statistics
Source:R/regularizedRegressionWrappers.R
mrmashRssWeights.RdMulti-context summary-statistics analog of mrmashWeights:
extracts coefficients from an existing mr.mashr::mr.mash.rss fit,
or fits one from stat (variants x conditions) and LD.
Usage
mrmashRssWeights(
stat,
LD,
mrmashRssFit = NULL,
dataDrivenPriorMatrices = NULL,
canonicalPriorMatrices = TRUE,
S0 = NULL,
w0 = NULL,
V = NULL,
covY = NULL,
retainFit = FALSE,
fitDetail = c("slim", "full"),
...
)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.
- mrmashRssFit
Optional pre-fitted
mr.mash.rssobject; skips fitting when supplied.- dataDrivenPriorMatrices
Optional list with element
U(list of raw covariance matrices). Passed directly tomr.mashr::expand_covs()alongside the canonical mixture.- canonicalPriorMatrices
Logical. When TRUE (default), include the standard canonical mixture from
mr.mashr::compute_canonical_covs(). When FALSE,dataDrivenPriorMatricesmust be supplied.- S0
Optional pre-built list of prior covariance matrices, bypassing the canonical / data-driven construction.
- w0
Optional prior mixture weights; defaults to
computeW0(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.
- retainFit
If TRUE, attaches (as the
"fit"attribute on the returned weights) the inputsfineMappingPipelineneeds to rebuild the mvSuSiE reweighted prior:dataDrivenPriorMatrices, the fittedw0, and the fittedV. Default FALSE.- fitDetail
How much to retain when
retainFit = TRUE."slim"(default) keeps only those reconstruction inputs (the coefficients are already the returned weights);"full"additionally keeps the completemr.mash.rssfit under$fit. MirrorsmrmashWeights.- ...
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
mrmashWrapper: computeGrid +
mr.mashr::compute_canonical_covs() +
mr.mashr::expand_covs() for S0, and
computeW0 for the mixture weights. Supply
dataDrivenPriorMatrices (e.g. from
computeCovFlash / computeCovDiag) to add
data-driven covariance components alongside the canonical mixture.