mvmr_egger_stan: Bayesian implementation of the MVMR-Egger model with choice...

Description Usage Arguments Value References Examples

View source: R/mvmr_egger_stan.R

Description

Bayesian implementation of the MVMR-Egger model with choice of prior distributions fitted using RStan.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
mvmr_egger_stan(
  data,
  prior = 1,
  n.chains = 3,
  n.burn = 1000,
  n.iter = 5000,
  seed = 12345,
  rho = 0.5,
  orientate = 1,
  ...
)

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 HMC estimation. The default is 5000 iterations.

seed

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

rho

Numeric indicating the correlation coefficient input into the joint prior distribution. The default is 0.5.

orientate

Numeric value to indicate the oriented exposure.

...

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

Value

An object of class stanfit.

References

Bowden J, Davey Smith G, Burgess S. Mendelian randomization with invalid instruments: effect estimation and bias detection through Egger regression. International Journal of Epidemiology, 2015, 44, 2, 512-525. doi: 10.1093/ije/dyv080.

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
if (requireNamespace("rstan", quietly = TRUE)) {
# Note we recommend setting n.burn and n.iter to larger values

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)
mvegger_fit <- mvmr_egger_stan(dat, n.burn = 500, n.iter = 1000)
print(mvegger_fit)
}

mrbayes documentation built on Oct. 2, 2021, 5:08 p.m.