Title: | Sensitivity Analysis Tools for Mendelian Randomization |
---|---|
Description: | The R package mrsensemakr implements sensitivity analysis tools for Mendelian Randomization. |
Authors: | Carlos Cinelli, |
Maintainer: | Carlos Cinelli <[email protected]> |
License: | GPL-3 |
Version: | 0.3 |
Built: | 2025-01-03 03:27:44 UTC |
Source: | https://github.com/carloscinelli/mrsensemakr |
MR-sensemakr
mr_sensemakr( outcome, exposure, instrument, covariates = NULL, data, benchmark_covariates = NULL, k = 1, alpha = 0.05 )
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 |
## 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))
## 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))
Simulated Data
A data frame with 200,000 observations and 27 variables.