Two-Sample Mendelian Randomization: TwoSampleMR and MR-PRESSO Guide

Weak instruments, palindromic allele misalignment, and horizontal pleiotropy can invalidate Mendelian randomization findings. Here is how to execute a STROBE-MR compliant pipeline in R using TwoSampleMR and MR-PRESSO.

HumanPen Team

· 15 min read

How Do You Build an Audit-Proof Two-Sample Mendelian Randomization Pipeline?

Two-sample Mendelian randomization (`2SMR`) leverages germline genetic variants from genome-wide association studies (`GWAS`) as instrumental variables (`IVs`) to estimate unconfounded causal relationships between modifiable exposures and disease outcomes. However, peer-reviewed journals adhering to the STROBE-MR reporting guidelines (Skrivankova et al. 2021) routinely issue desk rejections when researchers overlook three fatal pitfalls: weak-instrument bias from inadequate `F`-statistics, sign reversal from mishandled palindromic single nucleotide polymorphisms (`SNPs`), and horizontal pleiotropy violating the exclusion restriction. To build an audit-proof pipeline, researchers must implement genome-wide significance filtering (`p < 5e-8`), rigorous linkage disequilibrium clumping (`r2 < 0.001`, `kb = 10000`), per-instrument `F`-statistic validation (`F > 10`), strand harmonization (`action = 2` or `action = 3`), multiplicative random-effects inverse-variance weighted (`IVW`) meta-analysis, Cochran's `Q` heterogeneity testing, MR-Egger pleiotropy intercept evaluation, weighted median estimation, MR-PRESSO global and outlier tests, leave-one-out sensitivity analyses, and Steiger directionality checks.

"Include assumptions for relevance (the genetic variants are associated with the exposure of interest); independence (the genetic variants share no unmeasured cause with the outcome); and exclusion restriction (the genetic variants do not affect the outcome except through their potential effect on the exposure of interest)." (Skrivankova et al. 2021, BMJ)

Rigorous statistical inference in Mendelian randomization requires treating genetic variants as instrumental variables subject to standard econometric identification principles, similar to the diagnostics outlined in our guide on instrumental variables and 2SLS weak instrument diagnostics. Reviewers rarely contest the core arithmetic of the IVW regression; instead, they scrutinize whether instruments are truly independent of unobserved confounders, whether sample overlap between discovery cohorts inflates Type I error, and whether sensitivity analyses remain concordant across competing model assumptions. A defensible protocol does not depend on a single p-value, but demonstrates causal stability across complementary estimators that tolerate different mechanisms of instrumental invalidity.

  • 1. Instrument selection and clumping: Filter summary statistics at `p < 5e-8`, execute LD clumping at `clump_r2 = 0.001` across a `10,000 kb` window using ancestry-matched 1000 Genomes reference panels, and verify that per-SNP Wald statistics satisfy `F > 10`.
  • 2. Palindromic allele harmonization: Reconcile forward-strand effect alleles using `TwoSampleMR::harmonise_data` under `action = 2` to drop intermediate-frequency palindromes (`0.42 < EAF < 0.58`), or `action = 3` to discard all palindromic variants when allele frequencies are missing.
  • 3. Pleiotropy and heterogeneity sensitivity matrix: Report multiplicative random-effects IVW as the primary benchmark alongside Cochran's `Q`, evaluate directional pleiotropy via MR-Egger intercept under InSIDE, confirm robustness via weighted median (up to 50% invalid instruments), and correct for pleiotropic outliers via MR-PRESSO.
  • 4. Steiger directionality and overlap controls: Perform Steiger filtering (`r2_exposure > r2_outcome`) to rule out reverse causation, and restrict analysis to non-overlapping GWAS consortia to prevent weak-instrument bias toward confounded observational associations.

Core Instrumental Assumptions, LD Clumping, and Weak-Instrument F Diagnostics

The causal validity of any two-sample Mendelian randomization analysis rests entirely on three core instrumental variable assumptions codified in the STROBE-MR statement (Skrivankova et al. 2021). First, the Relevance assumption dictates that genetic instruments must associate strongly with the exposure of interest. To satisfy this condition, researchers select single nucleotide polymorphisms reaching genome-wide significance (`p < 5e-8`) in well-powered GWAS discovery cohorts. While studies investigating low-powered molecular traits or circulating metabolites occasionally relax this threshold to suggestive significance (`p < 5e-6`), STROBE-MR Items 5 and 6 require explicit methodological justification and comprehensive weak-instrument sensitivity analyses whenever the strict threshold is compromised. Second, the Independence assumption requires that the instruments share no common cause with the outcome, meaning they are free from confounding factors such as population stratification, assortative mating, or canalization. Third, the Exclusion Restriction assumption requires that instruments affect the outcome solely through the exposure pathway, with no alternative direct horizontal biological pathways.

To ensure statistical independence across selected genetic variants, raw instruments must undergo linkage disequilibrium (`LD`) clumping. In `TwoSampleMR` (`v0.7.14`), the `clump_data` function prunes correlated variants within a default genomic window of `clump_kb = 10000` (`10,000 kb`) at an LD threshold of `clump_r2 = 0.001`. A frequent methodological error is performing LD clumping on East Asian (`EAS`) or African (`AFR`) summary statistics using the default European (`EUR`) reference panel, which leaves substantial residual LD or inadvertently eliminates genuine causal lead variants. Researchers querying the OpenGWAS API must provide an authorized JSON Web Token (`OPENGWAS_JWT`) or execute local clumping via `ieugwasr::ld_clump` linked to a locally installed PLINK binary and ancestry-matched 1000 Genomes `.bed/.bim/.fam` reference files. Neglecting LD clumping inflates the effective degrees of freedom, inducing severe artificial precision in subsequent meta-analyses.

After extracting independent instruments, researchers must quantify instrumental strength using the first-stage `F`-statistic to guard against weak-instrument bias. In two-sample summary-level data, the Wald approximation for individual SNP `j` is computed as `F_j = β̂_X,j² / SE(β̂_X,j)²`. To compute the overall variance explained across `k` independent instruments, researchers determine `R_j² = 2 × β̂_X,j² × EAF_j × (1 - EAF_j) / [2 × β̂_X,j² × EAF_j × (1 - EAF_j) + 2 × N_j × SE(β̂_X,j)² × EAF_j × (1 - EAF_j)]` for each biallelic locus, and aggregate the metric using `F = [R² × (N - k - 1)] / [k × (1 - R²)]`. Instruments exhibiting `F_j <= 10` fail the conventional Staiger & Stock rule of thumb and should be pruned prior to harmonization. Furthermore, when reporting MR-Egger regressions, researchers must calculate the `I_GX²` statistic; values below `0.90` indicate substantial regression dilution that biases MR-Egger effect estimates toward the null. These diagnostic principles parallel the variance quantification standards used in RNA-seq differential expression analysis workflows.

"The causal estimate from a one-sample analysis (in which data are taken from a single data source) with weak instrumental variables is biased in the direction of the observational association between the risk factor and outcome, whereas the estimate from a two-sample analysis (in which data on the risk factor and outcome are taken from non-overlapping datasets) is less biased and any bias is in the direction of the null." (Burgess, Davies & Thompson 2016, Genetic Epidemiology)

Palindromic Allele Harmonization and the Pleiotropy Sensitivity Matrix

Even after rigorous clumping and F-statistic filtering, two-sample analyses will produce invalid causal inferences if alleles are harmonized incorrectly. In GWAS summary datasets, effect estimates `β̂` are reported relative to a designated effect allele (`EA`). When integrating exposure and outcome datasets generated by different consortia, researchers must guarantee that `β̂_X` and `β̂_Y` reflect identical strand orientations. For non-palindromic SNPs (such as `A/C` or `G/T`), strand flipping is unambiguous. However, palindromic SNPs (where alleles are `A/T` or `C/G`) present identical base pairing on forward and reverse DNA strands. Under the default setting `action = 2` in `TwoSampleMR::harmonise_data`, the algorithm attempts to infer strand orientation by comparing effect allele frequencies (`EAF`). Palindromic SNPs with intermediate allele frequencies near 0.5 (`0.42 < EAF < 0.58`) are automatically dropped because strand assignment is statistically ambiguous. When summary files lack allele frequency annotations, researchers must specify `action = 3` to discard all palindromic variants, avoiding fatal sign reversals where `β̂_Y` is incorrectly flipped.

"action = 1 : Assume all alleles are coded on the forward strand, i.e. do not attempt to flip alleles action = 2 : Try to infer positive strand alleles, using allele frequencies for palindromes (default, conservative); action = 3 : Correct strand for non-palindromic SNPs, and drop all palindromic SNPs from the analysis (more conservative)." (TwoSampleMR 0.7.14 Reference)
Estimator or Diagnostic MethodUnderlying Theoretical AssumptionPrimary Test Statistic & Formula TargetStrengths and Statistical PowerPractical Decision Rule & Limitations
Multiplicative Random-Effects IVWAll instruments valid or horizontal pleiotropy is balanced (mean zero)Inverse-variance weighted meta-analysis of Wald ratios theta_jHighest statistical power under no pleiotropyPrimary benchmark estimator; standard errors scaled by max(1, sqrt(Q / (K - 1)))
Cochran Q Heterogeneity TestEqual causal effects across all SNP Wald ratiosDispersion metric Q = sum w_j × (theta_j - theta_IVW)² ~ chi²_(K-1)Quantifies excess variation and instrument heterogeneityp < 0.05 indicates heterogeneity requiring pleiotropy investigation; do not switch to fixed-effects IVW
MR-Egger RegressionInstrument Strength Independent of Direct Effect (InSIDE)Intercept alpha_0 in regression beta_Y = alpha_0 + theta_Egger × beta_XDetects directional unbalanced horizontal pleiotropySignificant intercept (p < 0.05) signals pleiotropy; low statistical power and sensitive to I_GX² dilution
Weighted Median EstimatorAt least 50% of the total instrument weight originates from valid IVsMedian of sorted Wald ratios weighted by inverse varianceRobust to directional pleiotropy without requiring InSIDERemains consistent when up to 50% of weights are invalid; lower efficiency than IVW
MR-PRESSO FrameworkAt least 50% of instruments valid and InSIDE satisfiedGlobal residual sum of squares and single-SNP leave-one-out testsIdentifies and removes specific outlying pleiotropic variantsRequires at least 4 instruments; reports Global, Outlier, and Distortion p-values

Once data are harmonized, the primary causal effect is estimated via the multiplicative random-effects inverse-variance weighted (`IVW`) method (`mr_ivw`). IVW performs meta-analysis across SNP-specific Wald ratios `θ̂_j = β̂_Y,j / β̂_X,j` with weights `w_j = 1 / SE(θ̂_j)²`. Cochran's `Q` statistic (`mr_heterogeneity`) evaluates excess dispersion across ratios. A frequent reviewer misunderstanding involves forcing a switch from random-effects to fixed-effects IVW when `Q` is statistically significant (`p < 0.05`). In reality, fixed-effects IVW assumes complete absence of heterogeneity, whereas multiplicative random-effects IVW scales standard errors by `max(1, sqrt(Q / (K - 1)))`, providing proper confidence interval coverage under balanced pleiotropy. A significant `Q` test is not a call to restrict model variance, but an empirical signal to evaluate unbalanced horizontal pleiotropy using MR-Egger and the weighted median estimator.

"We developed MR-PRESSO to evaluate horizontal pleiotropy in multi-instrument summary-level MR. In brief, MR-PRESSO has three components (Online Methods and Figure 1), including: a) detection of horizontal pleiotropy (MR-PRESSO global test); b) correction for horizontal pleiotropy via outlier removal (MR-PRESSO outlier test); and c) testing of significant differences in the causal estimates before and after correction for outliers (MR-PRESSO distortion test)." (Verbanck et al. 2018, Nature Genetics)

To isolate and remove pleiotropic instruments, researchers execute the Mendelian Randomization Pleiotropy RESidual Sum and Outlier framework via `MRPRESSO::mr_presso(..., NbDistribution = 1000, SignifThreshold = 0.05)` (Verbanck et al. 2018). MR-PRESSO requires at least 4 instruments and operates under the premise that more than 50% of instruments are valid. It first runs a Global Test comparing observed residual sums of squares against a simulated null distribution. If significant horizontal pleiotropy is detected, the Outlier Test evaluates each SNP to pinpoint specific invalid instruments. Finally, the Distortion Test determines whether outlier removal significantly alters the causal estimate. Researchers must accompany MR-PRESSO with leave-one-out sensitivity plots (`mr_leaveoneout`) to confirm that the observed association is not driven by any single outlying variant. Similar validation principles for longitudinal clinical endpoints are detailed in our guide on Kaplan-Meier survival analysis and Cox proportional hazards regression.

Reverse Causation, Participant Overlap, and Audited HumanPen Start Project Workflows

Beyond horizontal pleiotropy, applied genetic epidemiology studies frequently confront reverse causation and sample overlap biases. The MR Steiger directionality test (Hemani et al. 2017) resolves potential reverse causation by testing whether the variance explained by genetic instruments in the exposure exceeds the variance explained in the outcome (`R²_exposure > R²_outcome`). When analyzing binary outcomes, researchers must not treat raw log-odds ratios (`log-OR`) as continuous standard deviation units; instead, they must convert effect sizes to the liability scale using `TwoSampleMR::get_r_from_lor()` parameterised by sample prevalence and population disease prevalence. Instruments exhibiting `R²_outcome >= R²_exposure` indicate that the outcome precedes or drives the exposure trait, requiring immediate exclusion via Steiger filtering (`steiger_filtering(dat)`).

The participant overlap trap presents another major threat to causal identification (Burgess, Davies & Thompson 2016). When researchers extract exposure and outcome summary statistics from overlapping cohorts—such as using UK Biobank participants for both exposure GWAS and outcome GWAS—the two-sample design partially collapses into a one-sample framework. Under substantial sample overlap, weak instruments bias causal estimates away from the null toward the confounded observational association according to the relationship `Bias ≈ overlap proportion × (1 / F) × β_obs`, sharply inflating false-positive rates. To satisfy STROBE-MR Item 10d, researchers must deliberately pair non-overlapping consortia (such as GLGC, GIANT, or CARDIoGRAMplusC4D with FinnGen or UK Biobank) or formally report overlap proportions and bias sensitivity calculations.

In HumanPen Start Project, researchers can configure reproducible two-sample Mendelian randomization pipelines, automated pleiotropy diagnostic suites, and STROBE-MR compliant reporting tables. Attach your data and papers, describe what you need, approve the plan before work starts, and get the reviewed report, charts, and code ready to preview online or download.

Execution parameters and data boundaries strictly follow established research standards: the platform accepts Excel, CSV, Word, PDF, and zip archives up to 5 GB total per project, accommodating large-scale GWAS summary statistics (`.tsv`, `.vcf.gz`, `.csv`). Quantitative and bioinformatic pipelines run inside private, isolated containerized sandboxes executing native Python or R environments with verified packages (`TwoSampleMR`, `ieugwasr`, `MendelianRandomization`, `MRPRESSO`, and `coloc`). Earlier analyses drafted in commercial software like SPSS or Stata are reproducibly reconstructed in Python or R with exact numerical replication. If projects require access-controlled biobanks or subscription datasets like UK Biobank application data, FinnGen, or protected clinical microdata, files must be exported beforehand by the researcher under their own institutional data user agreements. GPU training is not supported. An automated verification stage validates code execution and numerical outputs before final delivery, and researchers can request revisions within the same project workspace while preserving version history. Uploaded files are encrypted in transit, maintained in strict per-project isolation, never utilized for machine learning model training, retained for 6 months (180 days) after last activity with a 3-day advance notice, and can be permanently deleted at any moment.

Analysis code, Mendelian randomization estimates, and STROBE-MR sensitivity tables generated in Start Project serve as a reproducible methodological and learning reference scaffold; researchers must independently verify instrument biological plausibility, inspect raw diagnostic logs, and adhere to their institution's AI and data governance policies.

Frequently Asked Questions About Two-Sample Mendelian Randomization and MR-PRESSO

Why is Cochran's Q test significant when my instruments are genome-wide significant, and should I switch to fixed-effects IVW? Achieving genome-wide significance (`p < 5e-8`) ensures a strong association between the genetic variants and the exposure trait, satisfying the Relevance assumption. However, it does not prevent heterogeneity across individual SNP-specific Wald ratios `θ̂_j`. Significant Cochran's `Q` (`p < 0.05`) detects dispersion caused by differing causal pathways or horizontal pleiotropy. You should never switch to fixed-effects IVW under significant heterogeneity; fixed-effects models assume zero excess variance, producing artificially narrow confidence intervals. Instead, retain multiplicative random-effects IVW—which scales standard errors by `max(1, sqrt(Q / (K - 1)))`—and conduct MR-Egger, weighted median, and MR-PRESSO analyses to investigate the source of heterogeneity.

What should I do when TwoSampleMR harmonise_data drops dozens of SNPs due to palindromic ambiguity? Palindromic variants (`A/T` or `C/G`) with minor allele frequencies between 0.42 and 0.58 have ambiguous forward-reverse strand orientation that cannot be resolved safely using effect allele frequencies. Under `action = 2`, `TwoSampleMR` automatically drops these ambiguous SNPs to prevent catastrophic sign reversals where `β̂_Y` is incorrectly inverted. If your summary statistics lack allele frequency data entirely, you must use `action = 3` to discard all palindromic variants. While dropping SNPs slightly reduces instrument statistical power, retaining ambiguous palindromes introduces directional bias that invalidates causal inference.

How does MR-PRESSO differ from the MR-Egger intercept test in detecting horizontal pleiotropy? MR-Egger regression evaluates directional, unbalanced horizontal pleiotropy by testing whether the intercept `α_0` differs significantly from zero under the InSIDE assumption (Instrument Strength Independent of Direct Effect). If pleiotropic effects are balanced (averaging zero across instruments), MR-Egger's intercept test will fail to reject even when severe pleiotropic noise is present. In contrast, MR-PRESSO detects horizontal pleiotropy by evaluating excess residual sums of squares through permutation (Global Test), pinpoints individual outlying instruments (Outlier Test), and assesses whether causal estimates differ before and after outlier removal (Distortion Test). MR-PRESSO requires at least 4 instruments and assumes that more than 50% of instruments are valid.

How does HumanPen Start Project safeguard large GWAS summary statistics files and research datasets? File uploads up to 5 GB total per project (including compressed `.tsv.gz`, `.csv`, `.vcf.gz`, and analysis scripts) are protected by encrypted data transfer and execute within isolated, single-tenant container sandboxes running native Python or R environments. Research datasets are never utilized for training machine learning models and are never shared across project boundaries. Files are retained for 6 months (180 days) after last activity with an advance 3-day notification, and researchers retain the option to permanently delete project files from storage at any time.

Sources

KEEP READING