Mendelian randomization methods
How to use this page
Mendelian randomization estimates an exposure-outcome effect under assumptions about instrument relevance, independence, and exclusion restriction. Different estimators respond differently when some instruments violate those assumptions.
Method matrix
The counts below are software minimums. Three instruments leave very little information for diagnostics, bootstrapping, or stable density estimation.
| Method | Token | Minimum SNPs | Primary role |
|---|---|---|---|
| Inverse variance weighted | ivw | 2 | Main pooled estimate. |
| MR-Egger | egger | 3 | Directional pleiotropy sensitivity analysis. |
| Simple median | simple_median | 3 | Median ratio by instrument count. |
| Weighted median | weighted_median | 3 | Median ratio weighted by precision. |
| Penalized weighted median | penalized_weighted_median | 3 | Downweight heterogeneous ratio estimates. |
| Simple mode | simple_mode | 3 | Largest ratio-estimate cluster. |
| Weighted mode | weighted_mode | 3 | Precision-weighted modal cluster. |
| Penalized mode | penalized_mode | 3 | Modal estimate with outlier downweighting. |
| Simple mode NOME | simple_mode_nome | 3 | Simple mode under negligible exposure measurement error. |
| Weighted mode NOME | weighted_mode_nome | 3 | Weighted mode under negligible exposure measurement error. |
| MR-PRESSO | presso | 4 | Global pleiotropy and outlier correction. |
Core estimators
Inverse variance weighted
Use when: instruments are independent and valid, or horizontal pleiotropic effects are balanced around zero.
How it works: weighted regression of outcome effects on exposure effects through the origin, using inverse outcome-variance weights.
Strengths: efficient when assumptions hold; familiar primary estimate; supplies Cochran's Q heterogeneity statistics. PYPE uses a multiplicative random-effects standard error.
Caveats: directional pleiotropy and correlated instruments can bias the estimate. Random effects change uncertainty but do not remove pleiotropic bias. Weak instruments and sample overlap can also affect the estimate.
Multiplicative random effects and pleiotropy framework: Bowden J et al. A framework for the investigation of pleiotropy in two-sample summary data Mendelian randomization. Statistics in Medicine. 2017. doi:10.1002/sim.7221.
MR-Egger
Use when: directional horizontal pleiotropy is plausible and enough instrument-strength variation exists.
How it works: weighted regression with an intercept. The slope estimates the exposure effect and the intercept tests average directional pleiotropy.
Assumption: Instrument Strength Independent of Direct Effect, commonly called InSIDE.
Caveats: low power, sensitivity to weak instruments, and imprecise estimates with few SNPs. A non-significant intercept does not establish absence of pleiotropy.
Median estimators
Bowden J, Davey Smith G, Haycock PC, Burgess S. Consistent estimation in Mendelian randomization with some invalid instruments using a weighted median estimator. Genetic Epidemiology. 2016. doi:10.1002/gepi.21965.
Simple median
Use when: the majority of instruments are expected to be valid by count and instrument precision should not dominate the estimate.
How it works: median of the SNP-specific ratio estimates with equal instrument weights.
Caveats: discards precision information and can be inefficient when instrument standard errors differ substantially.
Weighted median
Use when: more than half of the total inverse-variance weight is expected to come from valid instruments.
Strengths: usually more efficient than the simple median and robust to a minority of invalid weighted instruments.
Caveats: the 50 percent condition concerns weight, not SNP count. Correlated instruments and winner's curse can distort those weights.
Penalized weighted median
Use when: a weighted median analysis contains ratio estimates with strong heterogeneity.
How it works: downweights variants whose ratio estimates are inconsistent with the initial weighted median.
Caveats: penalty behavior depends on the configured constant. Report the parameter and compare with the unpenalized estimate.
Mode estimators
Hartwig FP, Davey Smith G, Bowden J. Robust inference in summary data Mendelian randomization via the zero modal pleiotropy assumption. International Journal of Epidemiology. 2017. doi:10.1093/ije/dyx102.
Simple mode
Use when: the largest cluster of similar ratio estimates is expected to represent valid instruments.
Assumption: Zero Modal Pleiotropy Assumption, or ZEMPA.
How it works: kernel density estimation identifies the mode of equally weighted ratio estimates.
Caveats: sensitive to bandwidth choice and weakly separated clusters.
Weighted mode
Use when: ZEMPA is plausible and more precise instruments should contribute more strongly to the modal cluster.
Strengths: uses instrument precision while retaining the modal robustness target.
Caveats: a highly precise invalid cluster can dominate the estimate.
Penalized mode
Use when: a weighted mode analysis contains isolated heterogeneous ratio estimates.
How it works: penalizes variants based on distance from the initial weighted-mode estimate before recalculating the density mode.
Caveats: remains bandwidth-sensitive and should be compared with the unpenalized weighted mode. Penalization can hide disagreement and make uncertainty look smaller.
No distinct primary peer-reviewed paper defines this exact TwoSampleMR penalized-mode implementation. Cite the Hartwig mode paper, the penalization references, and the implementation used.
Simple and weighted mode with NOME
Use when: exposure effects are estimated precisely enough that measurement error can reasonably be treated as negligible.
How it differs: bootstrap ratio uncertainty uses outcome standard errors divided by the absolute exposure effect, omitting exposure-effect uncertainty.
Caveats: weak instruments violate the NOME approximation and can make uncertainty estimates optimistic.
Outlier analysis
MR-PRESSO
Use when: horizontal pleiotropic outliers are plausible and at least four instruments are available.
Assumptions: a majority of variants support the main relation, pleiotropy is sufficiently balanced, and outliers are separable from the main IVW pattern.
Outputs: global residual sum-of-squares test, per-SNP outlier test, distortion test, raw IVW estimate, and an outlier-corrected estimate when outliers are detected.
Strengths: identifies influential outliers and quantifies how their removal changes the estimate.
Caveats: empirical p-value precision depends on simulation_count. The method does not solve widespread balanced or directional pleiotropy when outliers are not isolated.
Practical selection
- Run IVW as the main pooled estimate.
- Use MR-Egger to inspect directional pleiotropy, while expecting lower precision.
- Compare weighted median and weighted mode for robustness to different invalid-instrument patterns.
- Use MR-PRESSO when isolated outliers and enough instruments are present.
- Report heterogeneity, retained SNP count, harmonization decisions, and all configured bootstrap parameters.
results, diagnostics = pype.mendelian_randomization(
exposure,
outcome,
methods=(
"ivw",
"egger",
"weighted_median",
"weighted_mode",
"presso",
),
seed=0,
)
Interpretation language
- Describe an estimate as consistent with an effect under the stated assumptions rather than proof that an exposure causes an outcome.
- Name the exact robustness condition: InSIDE, valid-weight majority, ZEMPA, balanced pleiotropy, or sparse outliers.
- Describe NOME as an assumption of negligible exposure-effect measurement error, not a correction for measurement error.
- Describe MR-PRESSO as detecting and removing outlying variants under its assumptions, not removing all pleiotropy.