Skip to contents

Estimate the residual (null) correlation matrix \(\hat V\) that mashr::mash_set_data() consumes as V. Split out of mashPipeline so the estimation logic lives in one place and is reusable by the mixture-prior workflows.

Usage

mashResidualCorrelation(
  sumStatsList,
  alpha,
  method = c("simple", "identity", "mle", "corshrink", "simple_specific"),
  priorCovariances = NULL,
  nSubset = 6000L,
  maxIter = 6L,
  inputScale = c("auto", "beta", "z"),
  setSeed = 999
)

Arguments

sumStatsList

Named list (or S4Vectors::SimpleList) of QtlSumStats / GwasSumStats. method = "simple" needs a "null" entry; method = "mle" needs "random"; method = "identity" reads only the condition count off "strong".

alpha

mash alpha (forwarded to mashr::mash_set_data()).

method

Estimator, all on the "null" partition unless noted. "simple" = mashr estimate_null_correlation_simple(); "identity" = diag(nConditions) (reads only "strong"); "simple_specific" = Matrix::nearPD(cov(nullZ), corr = TRUE); "corshrink" = CorShrink::CorShrinkData() adaptive-shrinkage correlation (needs the CorShrink package); "mle" = mashr::mash_estimate_corr_em() on a random subset (needs "random" + priorCovariances).

priorCovariances

Prior U list (required by method = "mle").

nSubset, maxIter

method = "mle" controls (random-subset size and EM iterations).

inputScale

SumStats -> matrix conversion scale ("auto" / "beta" / "z").

setSeed

Integer seed, or NULL to leave the ambient RNG stream untouched (how mashPipeline keeps one continuous stream across its delegated calls).

Value

A conditions x conditions residual correlation matrix.