Part 5: Advanced Simulations

Understanding MR Estimator Behavior Through Simulations

Goal

Study how two-sample Mendelian randomization (MR) estimators (Inverse-Variance Weighted (IVW) and MR-Egger) behave when core IV assumptions are violated.

Data-generating Model

Simulate individual-level genomes (SNPs), SNP effects on exposure X and outcome Y under configurable parameters, such as:

  • Number & strength of instruments
  • Pleiotropic effects (balanced vs directional)
  • InSIDE assumption validity

Part 1: Intuition-building (Single Draw)

In this section, we will single simulation draws to build intuition about how MR estimators behave under different scenarios. We will:

  • Produce scatter plots of SNP-exposure vs SNP-outcome effects
  • Overlay IVW and MR-Egger slopes to visualize bias
  • Compare slopes under different violation scenarios
  • Generate funnel plots to detect balanced vs directional pleiotropy
  • Explore how changing key parameters (pleiotropy type / intensity, instrument count, magnitude of causal effect) affects point estimates

Part 2: Monte-Carlo Simulations (Many Draws)

We will perform repeated simulations many times to record mean estimates, p-values, and empirical standard errors for each method. We will visualise bias, type I, and type II errors under 4 scenarios:

  1. No pleiotropy, InSIDE
  2. Balanced pleiotropy, InSIDE
  3. Directional pleiotropy, InSIDE
  4. Directional pleiotropy, InSIDE violated