mvmr.ivw: Perform inverse-variance weighted (IVW) estimator for...

View source: R/mvmr.ivw.R

mvmr.ivwR Documentation

Perform inverse-variance weighted (IVW) estimator for two-sample summary-data multivariable Mendelian randomization

Description

Perform inverse-variance weighted (IVW) estimator for two-sample summary-data multivariable Mendelian randomization

Usage

mvmr.ivw(beta.exposure, se.exposure, beta.outcome, se.outcome, gen_cor = NULL)

Arguments

beta.exposure

A data.frame or matrix. Each row contains the estimated marginal effect of a SNP on K exposures, usually obtained from a GWAS

se.exposure

A data.frame or matrix of estimated standard errors of beta.exposure

beta.outcome

A vector of the estimated marginal effect of a SNP on outcome, usually obtained from a GWAS

se.outcome

A vector of estimated standard errors of beta.outcome

gen_cor

A K-by-K matrix for the estimated shared correlation matrix between the effect of the genetic variants on each exposure, where K is the number of exposure. The correlations can either be estimated, be assumed to be zero, or fixed at zero using non-overlapping samples of each exposure GWAS. Default input is NULL, meaning that an identity matrix is used as the correlation matrix.

Value

A list with elements

beta.hat

Estimated direct effects of each exposure on the outcome

beta.se

Estimated standard errors of beta.hat

iv_strength_parameter

The minimum eigenvalue of the sample IV strength matrix, which quantifies the IV strength in the sample

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
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),c(1:4)]
mvmr.ivw(beta.exposure = beta.exposure,
se.exposure = se.exposure,
beta.outcome = beta.outcome,
se.outcome = se.outcome,
gen_cor = P)


tye27/mr.divw documentation built on Oct. 18, 2024, 12:06 a.m.