Skip to contents

Internal: bayesAlphabetRssWeights is the public interface; its backend = "pecotmr" runs this, and BayesAlphabetRssOptions sets the arguments below other than the data and the wrapper's own.

Usage

bayesAlphabetRss(
  bhat,
  ldFactor,
  n,
  method,
  nIter = 5000,
  nBurnin = 1000,
  thin = 5,
  pi = NULL,
  nPerVariant = NULL,
  bayesLForm = NULL,
  perVariantWeights = FALSE,
  h2 = 0.5,
  shrinkCorr = 1,
  ldProjection = 0.1,
  allowJumpSign = TRUE,
  raoBlackwell = FALSE,
  nChains = 1,
  verbose = FALSE
)

Arguments

bhat

The standardized marginal effects.

ldFactor

The factor F of the LD (k x p).

n

The sample size.

method

The prior, as in bayesAlphabetRssWeights.

nIter, nBurnin, thin

The chain's iterations (burn-in included), burn-in and thinning.

pi

For bayesB and bayesC, where the estimate of the non-null proportion starts.

nPerVariant

The per-variant sample sizes, read when perVariantWeights = TRUE.

bayesLForm

For bayesL only: "parkCasella" (the default, hibayes' form, the Laplace prior scaled by the residual variance) or "legarra" (Legarra et al. 2011, qgg's individual-level form, unscaled).

perVariantWeights

FALSE (default) weights every variant by n; TRUE weights each by qgg's 1 / (se^2 + b^2 / n_j), from its own sample size.

h2

The prior guess of the heritability that sets the starting variances. Default 0.5, qgg's and hibayes'.

shrinkCorr

The LD shrinkage \(c\): the sampler reads \(cR + (1 - c)I\). Default 1, none.

ldProjection

The ridge \(a\) of SDPR's likelihood (Zhou and Zhao 2021), under which the sampler reads the LD as \(R (R + aI)^{-1} R\) and the marginal effects as \(R (R + aI)^{-1} \hat\beta\): each of R's eigen-directions keeps \(\lambda / (\lambda + a)\) of the effects, so their part outside the reference LD's span, which a reference smaller than the window or unlike the study leaves, never enters. Without it the samplers' effects can grow without bound along those directions. Default 0.1, SDPR's; NULL reads the LD and the effects as they are.

allowJumpSign

Keep a drawn effect whose sign differs from the current one; FALSE sets it to zero, and out of the slab, instead. Default TRUE.

raoBlackwell

Report each effect's conditional posterior mean, averaged over the kept iterations, rather than the draws' average. Default FALSE.

nChains

The number of chains, each from a seed drawn from R's random number generator; they are tested for divergence and, with more than one, combined as prsCs's are. Default 1.

verbose

Whether to report the chain's progress.

Value

A list: betaEst (the posterior mean effects), pip (for bayesB, bayesC and bayesR, each effect's posterior probability of being non-null), pi (the non-null proportion) and residualVariance.

Details

The LD is a factor F of R = F'F / (k - 1), as a genotype reference gives it, and is never formed: each effect's update costs O(k). The likelihood is SBayes's, X'X = W^1/2 R W^1/2 and X'y = w * bhat for per-variant weights w, read by default through SDPR's projection (ldProjection). The priors are qgg's (CRAN 1.1.6) for bayesA, bayesC, bayesN and bayesR, hibayes' for bayesB (as BayesBpi), and for bayesL either.