mvmr_ivw_stan: Bayesian multivariate inverse variance weighted model with a...

View source: R/mvmr_ivw_stan.R

mvmr_ivw_stanR Documentation

Bayesian multivariate inverse variance weighted model with a choice of prior distributions fitted using RStan.

Description

Bayesian multivariate inverse variance weighted model with a choice of prior distributions fitted using RStan.

Usage

mvmr_ivw_stan(
  data,
  prior = 1,
  n.chains = 3,
  n.burn = 1000,
  n.iter = 5000,
  seed = 12345,
  ...
)

Arguments

data

A data of class mvmr_format.

prior

An integer for selecting the prior distributions;

  • 1 selects a non-informative set of priors;

  • 2 selects weakly informative priors;

  • 3 selects a pseudo-horseshoe prior on the causal effect.

n.chains

Numeric indicating the number of chains used in the HMC estimation in rstan, the default is 3 chains.

n.burn

Numeric indicating the burn-in period of the Bayesian HMC estimation. The default is 1000 samples.

n.iter

Numeric indicating the number of iterations in the Bayesian MCMC estimation. The default is 5000 iterations.

seed

Numeric indicating the random number seed. The default is 12345.

...

Additional arguments passed through to rstan::sampling().

Value

An object of class rstan::stanfit.

References

Burgess, S., Butterworth, A., Thompson S.G. Mendelian randomization analysis with multiple genetic variants using summarized data. Genetic Epidemiology, 2013, 37, 7, 658-665 \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/gepi.21758")}.

Stan Development Team (2020). "RStan: the R interface to Stan." R package version 2.19.3, https://mc-stan.org/.

Examples

if (requireNamespace("rstan", quietly = TRUE)) {
dat <- mvmr_format(
  rsid = dodata$rsid,
  xbeta = cbind(dodata$ldlcbeta,dodata$hdlcbeta,dodata$tgbeta),
  ybeta = dodata$chdbeta,
  xse = cbind(dodata$ldlcse,dodata$hdlcse,dodata$tgse),
  yse = dodata$chdse
)
suppressWarnings(mvivw_fit <- mvmr_ivw_stan(dat, refresh = 0L))
print(mvivw_fit)
rstan::traceplot(mvivw_fit)
}

mrbayes documentation built on Sept. 11, 2024, 6:45 p.m.