Skip to contents

bayesAlphabetRssWeights with the BayesR prior.

Usage

bayesRRssWeights(
  stat,
  ldReference,
  backend = NULL,
  nIter = 5000,
  nBurnin = 1000,
  thin = 5,
  shrinkCorr = 0.95,
  fitRetention = c("none", "slim", "full"),
  methodArgs = NULL
)

Arguments

stat

A list of summary statistics: n (per-variant sample sizes) and the marginal effects as cor (standardized), z, b with seb, or b alone, taken as already standardized. The engines receive the standardized effects z / sqrt(n), with n the median of n.

ldReference

The LD reference the statistics' variants are matched to by stat$variantNames: a genotype panel (see readGenotypes), a GenotypeMixture or an LdMatrix.

backend

"qgg", "hibayes" or "pecotmr"; NULL picks the default for the LD reference.

nIter

Integer. Total number of MCMC iterations, burn-in included, on every engine. Default 5000.

nBurnin

Integer. Number of burn-in iterations discarded; less than nIter. Default 1000.

thin

Integer. Thinning interval for retained MCMC samples. Default 5.

shrinkCorr

The LD shrinkage \(c\): every engine reads \(cR + (1 - c)I\), qgg and hibayes as the matrix they are given, pecotmr's sampler through the factor. Default 0.95, the LDpred2 vignette's. A reference with fewer samples than the window has variants lacks directions the statistics have, and without shrinkage the samplers' effects can grow without bound along them (pecotmr's sampler also drops those directions by default, through SDPR's likelihood; see bayesAlphabetRssWeights). A small or mismatched reference does better with less, down to 0.4 as the LDpred2 vignette advises; the study's own genotypes as the reference need none, up to 1.

fitRetention

How much of the fit is kept as the "fit" attribute of the returned weights: "none" (default) attaches nothing, "slim" and "full" attach the engine's estimates (betaEst, and where the engine gives them the inclusion probabilities pip, the non-null proportion pi and the residual variance), backend and the shrinkCorr used. No engine keeps trimmable intermediates, so the two retaining levels behave alike.

methodArgs

Options for the backend's engine, built with its constructor: QggOptions for qgg, HibayesRssOptions for hibayes, BayesAlphabetRssOptions for pecotmr's sampler. NULL keeps the engine's defaults.

Value

A numeric vector of the posterior mean effects, one per variant.

Examples

data(eqtlRegionExample)
X <- eqtlRegionExample$X[, 1:30]
stat <- list(
  z = as.vector(cor(X, eqtlRegionExample$yRes)) * sqrt(nrow(X)),
  n = rep(nrow(X), ncol(X)),
  variantNames = colnames(X)
)
bayesRRssWeights(stat, LdMatrix(cor(X)), "hibayes", nIter = 1000,
  nBurnin = 200)
#>  [1] -2.887230e-03 -4.748196e-03  1.765330e-03 -1.423034e-03 -4.551287e-04
#>  [6] -2.028051e-03 -1.684843e-03  1.174772e-03 -1.045486e-03  7.092007e-04
#> [11] -7.619483e-04 -3.155411e-03 -1.264380e-03 -1.438423e-04 -5.884024e-04
#> [16]  3.047931e-03 -1.896856e-03 -2.418185e-04  8.993368e-04 -5.043595e-04
#> [21] -9.735005e-04 -2.146926e-03 -3.230834e-03 -4.242292e-06 -2.450746e-04
#> [26] -9.736134e-04 -6.473676e-03 -1.226245e-03  2.529348e-03  9.732139e-05