mvmr: mvmr (legacy)

View source: R/mvmr.R

mvmrR Documentation

mvmr (legacy)

Description

Note: This function is from the old version of the MVMR package and will be replaced in the future: The gencov argument should be set to zero when using mvmr().

Usage

mvmr(r_input, gencov, weights)

Arguments

r_input

A formatted data frame using the format_mvmr function or an object of class MRMVInput from MendelianRandomization::mr_mvinput

gencov

Calculating heterogeneity statistics requires the covariance between the effect of the genetic variants on each exposure to be known. This can either be estimated from individual level data, be assumed to be zero, or fixed at zero using non-overlapping samples of each exposure GWAS. A value of 0 is used by default.

weights

A value specifying the inverse variance weights used to calculate IVW estimate and Cochran's Q statistic. Currently only first order weights are available (1).

Details

Fits an IVW multivariable Mendelian randomization model using first order weights. The function returns an object of class "MVMRIVW", containing regression estimates, estimated heterogeneity as a measure of instrument strength (Q_strength), and estimated heterogeneity as a measure of instrument validity (Q_valid).

Value

An object of class "MVMRIVW" containing the following components:

summary

A summary of the MVMR regression model, including estimated coefficients, standard errors, t-statistics, p-values, and heterogeneity statistics.

coef

The estimated coefficients, their standard errors, t-statistics, and corresponding (two-sided) p-values.

Q_strength

A data frame displaying modified Cochran's Q statistics for assessing instrument strength with respect to each exposure. The Q-statistic increases proportionally with instrument strength, and analogous to univariate MR analyses, a value equal to or greater than 10 can be used as a minimum threshold for instrument strength. Note that for these statistics it is not informative to evaluate p-values.

Q_valid

A modified form of Cochran's Q statistic measuring heterogeneity in causal effect estimates obtained using each genetic variant. Observed heterogeneity is indicative of a violation of the exclusion restriction assumption in MR (validity), which can result in biased effect estimates.

p_valid

A p-value corresponding to the heterogeneity measure for instrument validity (Q_valid)

Author(s)

Wes Spiller; Eleanor Sanderson; Jack Bowden.

References

Sanderson, E., et al., An examination of multivariable Mendelian randomization in the single-sample and two-sample summary data settings. International Journal of Epidemiology, 2019, 48, 3, 713-727. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/ije/dyy262")}

Examples

# Example using format_mvmr formatted data
r_input <- format_mvmr(
    BXGs = rawdat_mvmr[,c("LDL_beta","HDL_beta")],
    BYG = rawdat_mvmr$SBP_beta,
    seBXGs = rawdat_mvmr[,c("LDL_se","HDL_se")],
    seBYG = rawdat_mvmr$SBP_se,
    RSID = rawdat_mvmr$SNP)
mvmr(r_input, 0, 1)

# Example using MRMVInput formatted data from the MendelianRandomization package
if (require("MendelianRandomization", quietly = TRUE)) {
bx <- as.matrix(rawdat_mvmr[,c("LDL_beta", "HDL_beta")])
bxse <- as.matrix(rawdat_mvmr[,c("LDL_se", "HDL_se")])
dat <- MendelianRandomization::mr_mvinput(bx = bx,
                                          bxse = bxse,
                                          by = rawdat_mvmr$SBP_beta,
                                          byse = rawdat_mvmr$SBP_se,
                                          snps = rawdat_mvmr$SNP)
mvmr(r_input = r_input, gencov = 0, weights = 1)
}

WSpiller/MVMR documentation built on May 17, 2023, 5:48 p.m.