Created
April 28, 2017 10:55
-
-
Save explodecomputer/60d36b2269771aaa28dfa11be6850ca4 to your computer and use it in GitHub Desktop.
multivariable mr example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Lipids (GLGC) against CHD | |
id_exposure <- c(299, 300, 302) | |
id_outcome <- 7 | |
# Get exposures | |
exposure_dat <- mv_extract_exposures(id_exposure) | |
# Chris - if you have external data then is it possible to create the same format as this? | |
# - it's in long format | |
# - each SNP appears as many times as there are exposures | |
# - the effect allele for each SNP is the same in each exposure | |
# If so, then you can use the extract_outcome_data and mv_harmonise_data functions below for each outcome | |
# Get outcomes | |
outcome_dat <- extract_outcome_data(exposure_dat$SNP, id_outcome) | |
# Harmonise | |
mvdat <- mv_harmonise_data(exposure_dat, outcome_dat) | |
# Perform analysis | |
res <- mv_basic(mvdat) | |
res_nothresh <- mv_basic(mvdat, pval_threshold=1) | |
res$result | |
res_nothresh$result | |
# Chris - perhaps you can look at this function and make a new one with the modified model? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment