Giter Site home page Giter Site logo

mrmix's Introduction

MRMix

R package for two-sample Mendelian randomization analysis using mixture models. For numerical stability, we recommend using summary statistics in the standardized scale: 1) for continuous phenotypes, both the genotypes and phenotypes need to be standardized to have mean 0 and variance 1; 2) For binary phenotypes, the genotypes need to be standardized to have mean 0 and variance 1. Causal estimates are interpreted as standard deviation (SD) unit increase (continuous outcome) or log-OR (binary outcome) of Y per SD unit increase in X (assumed to be continous). See Example for how to obtain summary statistics in the standardized scale.

System requirements

MRMix can be used on any operating system. R needs to be installed. Package devtools is required for the installation.

Installation

devtools::install_github("gqi/MRMix")

Example

library(MRMix)
data("sumstats", package = "MRMix")
# Convert summary statistics to standardized scale
# beta_standardized=beta/se/sqrt(N); se_standardized=1/sqrt(N).
betahat_x = sumstats$betahat_x/sumstats$sx/sqrt(sumstats$nx)
betahat_y = sumstats$betahat_y/sumstats$sy/sqrt(sumstats$ny)
sx = 1/sqrt(sumstats$nx)
sy = 1/sqrt(sumstats$ny)
# MRMix analysis
est = MRMix(betahat_x, betahat_y, sx, sy)
data.frame(est) # True causal effect is 0.2.

#   theta       pi0       sigma2   SE_theta zstat_theta pvalue_theta
# 1  0.21 0.4602256 8.998972e-05 0.02449794    8.572151 1.015702e-17

If the phenotype is continuous and analyzed with linear regression, or binary and analyzed with logistic regression, the standardized-scale standard error is 1/sqrt(N) and beta is z-statistics/sqrt(N). For continuous phenotypes, N is the total sample size and for binary phenotypes N is the effective sample size, calculated as Ncase*Ncontrol/(Ncase+Ncontrol). This relationship may not hold for non-standard analysis methods and standardization would require the phenotypic variance. Type ?MRMix in R for more details. The software has been tested on MAC OS 10.11.5 with 2.8 GHz Intel Core i7 and R version 3.5.1. Installation and the Example complete within seconds on this platform.

More information

Authors: Guanghao Qi ([email protected]) and Nilanjan Chatterjee ([email protected])

Reference: Qi, Guanghao, and Nilanjan Chatterjee. "Mendelian Randomization Analysis Using Mixture Models (MRMix) for Genetic Effect-Size-Distribution Leads to Robust Estimation of Causal Effects." bioRxiv (2018): 367821.

Scripts for simulations in this paper (scenarios A, B and C) are available here.

Scripts for data analysis in this paper are available here. A brief introduction is available here.

mrmix's People

Contributors

gqi avatar

Watchers

James Cloos avatar Genetics avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.