Shared helper used by both mrmash_wrapper (individual-level)
and mrmash_rss_weights (summary statistics). Constructs the
S0 list of prior covariance matrices via the canonical mixture
(mr.mashr::compute_canonical_covs) and optional data-driven
matrices, expanded over a scaling grid via
mr.mashr::expand_covs. The prior grid is derived from Bhat
and Shat via compute_grid when not supplied.
Usage
build_mrmash_prior_matrices(
Bhat,
Shat,
K = NULL,
data_driven_prior_matrices = NULL,
canonical_prior_matrices = TRUE,
prior_grid = NULL,
hetgrid = c(0, 0.25, 0.5, 0.75, 1),
singletons = TRUE
)Arguments
- Bhat
Numeric matrix of effect-size estimates (variants x conditions).
- Shat
Numeric matrix of standard errors (variants x conditions).
- K
Number of conditions. When NULL, inferred from
ncol(Bhat).- data_driven_prior_matrices
Optional list with element
U(list of raw covariance matrices) computed e.g. bycompute_cov_flash/compute_cov_diag.- canonical_prior_matrices
Logical. When TRUE (default for RSS), include the standard canonical mixture from
mr.mashr::compute_canonical_covs(). When FALSE,data_driven_prior_matricesmust be supplied.- prior_grid
Optional pre-computed scaling grid (numeric vector). When NULL, derived from
Bhat,Shatviacompute_grid().- hetgrid
Heterogeneity grid passed to
mr.mashr::compute_canonical_covs(). Defaultc(0, 0.25, 0.5, 0.75, 1), matching the individual-level wrapper.- singletons
Whether to include single-condition prior components. Default TRUE.