Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
^.*\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
^CITATION\.cff$
22 changes: 12 additions & 10 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
Package: mr.divw
Type: Package
Title: debiased inverse-variance weighted estimator for univariable and multivariable Mendelian randomization
Title: debiased inverse-variance weighted estimator for univariable and
multivariable Mendelian randomization
Version: 0.1.0
Author: c(person("Ting", "Ye", , "tingye1@uw.edu", role = c("aut", "cre")),
person("Yinxiang", "Wu", , "wuyx@uw.edu", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-7806-6999")))
Maintainer: The package maintainer <yourself@somewhere.net>
Description: Perform causal effect estimation for summary-data Mendelian randomization using IVW, dIVW and MV-SRIVW estimators.
Authors@R: c(
person("Ting", "Ye", , "tingye1@uw.edu", role = c("aut", "cre")),
person("Yinxiang", "Wu", , "wuyx@uw.edu", role = "aut",
comment = c(ORCID = "0000-0001-7806-6999"))
)
Description: Perform causal effect estimation for summary-data Mendelian
randomization using IVW, dIVW and MV-SRIVW estimators.
License: MIT + file LICENSE
Depends:
R (>= 3.5)
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.3
Depends:
R (>= 2.10)
RoxygenNote: 7.3.3
162 changes: 86 additions & 76 deletions R/functions.R

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions R/globals.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
utils::globalVariables(c(
"bmi.cad",
"beta.exposure",
"beta.outcome",
"se.exposure",
"se.outcome",
"pval.selection"
))
6 changes: 4 additions & 2 deletions R/mvmr.ivw.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
#'
#' @examples
#' data("hdl_subfractions")
#' # We are going to estimate the effect of S-HDL-P on the risk of CAS with adjustments of HDL, LDL, and TG levels
#' beta.exposure <- hdl_subfractions$data[,c("gamma_exp1","gamma_exp2","gamma_exp3","gamma_exp4")] # corresponding to SNP effects on respectively HDL, LDL, TG, and S-HDL-P
#' # Estimate the effect of S-HDL-P on CAS risk, adjusting for HDL, LDL, and TG
#' # Columns: SNP effects on HDL, LDL, TG, and S-HDL-P respectively
#' beta.exposure <- hdl_subfractions$data[,
#' c("gamma_exp1","gamma_exp2","gamma_exp3","gamma_exp4")]
#' se.exposure <- hdl_subfractions$data[,c("se_exp1","se_exp2","se_exp3","se_exp4")]
#' beta.outcome <- hdl_subfractions$data$gamma_out1
#' se.outcome <- hdl_subfractions$data$se_out1
Expand Down
9 changes: 6 additions & 3 deletions R/mvmr.srivw.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@
#'
#' @examples
#' data("hdl_subfractions")
#' # We are going to estimate the effect of S-HDL-P on the risk of CAS with adjustments of HDL, LDL, and TG levels
#' beta.exposure <- hdl_subfractions$data[,c("gamma_exp1","gamma_exp2","gamma_exp3","gamma_exp4")] # corresponding to SNP effects on respectively HDL, LDL, TG, and S-HDL-P
#' # Estimate the effect of S-HDL-P on CAS risk, adjusting for HDL, LDL, and TG
#' # Columns: SNP effects on HDL, LDL, TG, and S-HDL-P respectively
#' beta.exposure <- hdl_subfractions$data[,
#' c("gamma_exp1","gamma_exp2","gamma_exp3","gamma_exp4")]
#' se.exposure <- hdl_subfractions$data[,c("se_exp1","se_exp2","se_exp3","se_exp4")]
#' beta.outcome <- hdl_subfractions$data$gamma_out1
#' se.outcome <- hdl_subfractions$data$se_out1
#' P <- hdl_subfractions$cor.mat[c(1:4,10),c(1:4,10)] # make sure the last index corresponds to the outcome
#' # last index must correspond to the outcome
#' P <- hdl_subfractions$cor.mat[c(1:4,10),c(1:4,10)]
#' mvmr.srivw(beta.exposure = beta.exposure,
#' se.exposure = se.exposure,
#' beta.outcome = beta.outcome,
Expand Down
6 changes: 3 additions & 3 deletions man/mr.divw.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 17 additions & 9 deletions man/mr.eo.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions man/mvmr.ivw.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions man/mvmr.srivw.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions mr.divw.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace