Skip to contents

Multi-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) and n (per-context numeric vector or scalar). May also include Bhat, Shat matrices.

LD

LD correlation matrix.

mrmashRssFit

Optional pre-fitted mr.mash.rss object; skips fitting when supplied.

dataDrivenPriorMatrices

Optional list with element U (list of raw covariance matrices). Passed directly to mr.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, dataDrivenPriorMatrices must 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 inputs fineMappingPipeline needs to rebuild the mvSuSiE reweighted prior: dataDrivenPriorMatrices, the fitted w0, and the fitted V. 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 complete mr.mash.rss fit under $fit. Mirrors mrmashWeights.

...

Additional arguments forwarded to mr.mashr::mr.mash.rss.

Value

A numeric matrix of per-variant per-context weights (variants x conditions).

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.