Description Usage Arguments Examples
MR-sensemakr
1 2 3 4 5 6 7 8 9 10 | mr_sensemakr(
outcome,
exposure,
instrument,
covariates = NULL,
data,
benchmark_covariates = NULL,
k = 1,
alpha = 0.05
)
|
outcome |
A character vector with the name of the outcome trait. |
exposure |
A character vector with the name of the exposure trait. |
instrument |
A character vector with the name of the genetic instrument. |
covariates |
A character vector with the name of the control covariates, such as age, sex, genomic principal components, batch effect dummies and putative pleiotropic pathways. |
data |
An object of the class data.frame containing the variables used in the analysis. |
benchmark_covariates |
Covariates for benchmarking. Must be a subset of the |
k |
numeric vector. Parameterizes how many times stronger residual biases are related to the treatment and the outcome in comparison to the observed benchmark covariates. |
alpha |
significance level |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ## loads package
library(mrsensemakr)
## simulated data example
data("sim_data")
## create vectors indicating variable names in the data
outcome <- "out.trait" # name of outcome trait
exposure <- "exp.trait" # name of exposure trait
instrument <- "prs" # genetic instrument (e.g, polygenic risk score)
age.sex <- c("age", "sex") # age and sex variables (if applicable)
alc.smok <- c("alcohol", "smoking") # putative pleoitropic vars.
pcs <- paste0("pc", 1:20) # first 20 principal components pc1 ... pc20
## runs MR sensitivity analysis
mr.sense <- mr_sensemakr(outcome = outcome,
exposure = exposure,
instrument = instrument,
covariates = c(age.sex, alc.smok, pcs),
data = sim_data,
benchmark_covariates = list(alc.smok = alc.smok,
pcs = pcs))
## print results
mr.sense
## sensitivity contour plots
plot(mr.sense,
benchmark_covariates = list(alc.smok = alc.smok,
pcs = pcs),
k = list(alc.smok = 25,
pcs = 35))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.