format_mvmr: format_mvmr

View source: R/format_function.R

format_mvmrR Documentation

format_mvmr

Description

Reads in summary data. Checks and organises columns for use in calculating multivariable Mendelian Randomization analyses. Where variant IDs are not provided, a vector is generated for variant identification.

Usage

format_mvmr(BXGs, BYG, seBXGs, seBYG, RSID)

Arguments

BXGs

A matrix containing beta-coefficient values for genetic associations with the each exposure. Columns should indicate exposure number, with rows representing estimates for a given genetic variant.

BYG

A numeric vector of beta-coefficient values for genetic associations with the outcome.

seBXGs

A matrix containing standard errors corresponding to the matrix of beta-coefficients BXGs.

seBYG

A numeric vector of standard errors corresponding to the beta-coefficients BYG.

RSID

A vector of names for genetic variants included in the analysis. If variant IDs are not provided (RSID="NULL"), a vector of ID numbers will be generated.

Value

A formatted data frame of class mvmr_format.

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

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)
names(r_input)
class(r_input)

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