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

Description Usage Arguments Value References Examples

View source: R/mvmr_egger_rjags.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
mvmr_egger_rjags(
  object,
  prior = "default",
  betaprior = "",
  sigmaprior = "",
  orientate = 1,
  n.chains = 3,
  n.burn = 1000,
  n.iter = 5000,
  seed = NULL,
  rho = 0.5,
  ...
)

Arguments

object

A data object of class mvmr_format.

prior

A character string for selecting the prior distributions;

  • "default" selects a non-informative set of priors;

  • "weak" selects weakly informative priors;

  • "pseudo" selects a pseudo-horseshoe prior on the causal effect;

betaprior

A character string in JAGS syntax to allow a user defined prior for the causal effect.

sigmaprior

A character string in JAGS syntax to allow a user defined prior for the residual standard deviation.

orientate

Numeric value to indicate the oriented exposure

n.chains

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

n.burn

Numeric indicating the burn-in period of the Bayesian MCMC 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 the rjags default.

rho

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

...

Additional arguments passed through to rjags::jags.model().

Value

An object of class mveggerjags containing the following components: if (requireNamespace("rjags", quietly = TRUE))

References

Bowden et. al., Mendelian randomization with invalid instruments: effect estimation and bias detection through Egger regression. International Journal of Epidemiology 2015. 44(2): p. 512-525. doi: 10.1093/ije/dyv080

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
if (requireNamespace("rjags", 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)

fit <- mvmr_egger_rjags(dat)
summary(fit)
plot(fit$samples)
# 90% credible interval
fitdf <- do.call(rbind.data.frame, fit$samples)
cri90 <- sapply(fitdf, quantile, probs = c(0.05, 0.95))
print(cri90)
}

## End(Not run)

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