Skip to content

Code for time-resolved Mendelian Randomization analysis

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

AJResearchGroup/TimeResolvedMR

Repository files navigation

TimeResolvedMR

R-CMD-check

Estimate time-varying effects of an exposure on an outcome using genetic instrumental variables through Mendelian1 Randomization

Installation

You can install the development version of TimeResolvedMR from GitHub with:

# install.packages("devtools")
devtools::install_github("AJResearchGroup/TimeResolvedMR")

Example

The following is the basic workflow we used in our upcoming paper. This estimates the time-dependent effect of a continuous exposure (BMI) on a binary outcome (Type 2 diabetes). The time-dependent genetic effects are estimated using a generalized linear model including interactions PGS:age and PGS:(age^4) and an Aalen additive hazards model.

library(TimeResolvedMR)

# Assuming you got polygenic scores and all exposure,outcome and covariate
# measurements you need

exposure_model <- time_dependent_glm(
  pgs = pgs,
  pheno = bmi,
  age =  age_at_assessment,
  covariates = covariates,
  exponents = c(1,4)
)

outcome_model <- time_dependent_aalen(
  pgs = pgs,
  pheno = t2_diabetes,
  event_age = age_at_diagnose,
  covariates = covariates
)

time_dependent_MR(exposure_model, outcome_model)

About

Code for time-resolved Mendelian Randomization analysis

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published

Languages