Skip to contents

Constructs a mixture prior for use with mvsusie(). Accepts one of three input types:

  • fitted_g: Output from mashr::mash(), which provides data-driven mixture weights and covariance matrices. This is the recommended approach for large R.

  • mixture_prior: A list with matrices (list of covariance matrices) and optional weights.

  • R: Number of outcomes, to auto-generate canonical covariance matrices (singletons + shared effects).

Usage

create_mixture_prior(
  mixture_prior,
  R,
  null_weight = NULL,
  weights_tol = 1e-10,
  max_mixture_len = -1,
  grid = NULL,
  fitted_g = NULL,
  include_indices = NULL,
  ...
)

Arguments

mixture_prior

A list of (weights = vector(), matrices = list()) where matrices is a list of prior covariance matrices.

R

Number of outcomes. Generates canonical covariance matrices via create_cov_canonical(R).

null_weight

Weight for the null component in single effect models. For fitted_g, defaults to the mash-estimated null weight. Use null_weight = 0 to override.

weights_tol

Filter out mixture components with weights smaller than weights_tol.

max_mixture_len

Only keep the top priors by weight so that the list of mixture prior is of length max_mixture_len. Use max_mixture_len = -1 to include all input weights after filtering by weights_tol.

grid

Numeric vector of scaling factors for the canonical covariance matrices (used only with R). When provided, each canonical matrix is scaled by each grid value, producing length(Ulist) * length(grid) mixture components. When NULL (default), unscaled canonical matrices are used directly.

fitted_g

The fitted_g element from mashr::mash() output. Must contain Ulist, grid, pi, and usepointmass. The estimated mixture weights are used directly.

include_indices

Post-process input prior to only include outcomes at these indices.

...

Other parameters passed to mvsusieR:::create_cov_canonical (e.g., singletons, hetgrid).

Value

A mash_prior object for use with mvsusie().

Examples

# Canonical prior for R=3 outcomes:
prior <- create_mixture_prior(R = 3)

# Data-driven prior from mashr (recommended for large R):
# m <- mashr::mash(data, Ulist = c(U.ed, U.c))
# prior <- create_mixture_prior(fitted_g = m$fitted_g)