Tutorials › High-Dimensional Genomic Data Analysis › Worked Summary-Data Mendelian Randomization Analysis

Mendelian Randomization · Tutorial 695 of 795

Worked Summary-Data Mendelian Randomization Analysis

Work through allele harmonization, IVW estimation, heterogeneity testing, and complementary sensitivity estimates while keeping the assumptions and limits of causal interpretation in view.

Advanced 12 min read

What You'll Learn

  • Align exposure and outcome associations to the same effect allele before analysis.
  • Calculate an IVW estimate and its conventional standard error from summary statistics.
  • Assess between-variant heterogeneity using Cochran’s Q.
  • Compare IVW with weighted-median and MR-Egger sensitivity estimates.
  • Explain what agreement or disagreement among estimates can and cannot establish.
  • Identify assumptions and data problems that can undermine summary-data MR.

From Summary Statistics to a Cautious MR Result

A summary-data Mendelian randomization (MR) analysis combines genetic associations with an exposure and with an outcome to estimate the change in outcome associated with a change in exposure. Even a small analysis involves more than dividing one association by another: the associations must refer to the same allele, the instruments must be suitable, and the pattern across variants must be examined. This tutorial follows a hypothetical example from allele harmonization through inverse-variance weighting (IVW), heterogeneity assessment, and two pleiotropy-robust sensitivity estimates.

The outcome here is continuous. Each exposure association is measured in standard-deviation (SD) units of exposure per effect allele, and each outcome association is measured in SD units of outcome per effect allele. The target estimate is therefore in SD units of outcome per SD unit of exposure. The calculations illustrate an analysis, not evidence from a real study.

Assumptions and Harmonization

Definition: For variant \(j\), let \(\hat{\beta}_{Xj}\) be its estimated association with the exposure and \(\hat{\beta}_{Yj}\) its estimated association with the outcome. In a two-sample summary-data analysis, these estimates usually come from separate exposure and outcome association studies. To form a ratio for variant \(j\), both estimates must describe the same effect allele. The ratio estimate is \(\hat{\beta}_{Yj}/\hat{\beta}_{Xj}\), provided \(\hat{\beta}_{Xj}\ne 0\).

Before interpreting that ratio as a causal estimate, the analysis needs assumptions. First, relevance requires the variants to be associated with the exposure. Second, independence requires the variants to be independent of confounders of the exposure–outcome relationship; population structure or selection can threaten this assumption. Third, the exclusion restriction requires each variant to affect the outcome only through the exposure. A direct effect on the outcome or a pathway through another trait can violate it. These assumptions are not established merely by observing strong genetic associations.

Harmonization checks the effect and other allele reported by each association study. If the outcome association is reported per the allele that is the other allele in the exposure study, its sign must be reversed. For example, an outcome association of \(-0.02\) per T allele becomes \(+0.02\) per C allele when the exposure association is reported per C allele. Strand-ambiguous variants require particular care: if allele frequency information cannot resolve their orientation reliably, they should not be forced into an alignment.

Worked Example: Aligning Effect Alleles

Suppose a hypothetical instrument has exposure alleles C/T and an exposure association of \(0.08\) SD per C allele. The outcome study reports alleles T/C and an outcome association of \(-0.02\) SD per T allele. The studies use the same variant, but the reported effect alleles differ.

The outcome association per C allele is the sign-reversed value, \(-(-0.02)=0.02\) SD. The harmonized ratio is therefore \(0.02/0.08=0.25\) SD of outcome per SD of exposure. Dividing the unharmonized values would give \(-0.02/0.08=-0.25\), the wrong direction, because the numerator would describe the opposite allele.

This alignment solves an allele-coding problem; it does not show that the variant satisfies the exclusion restriction or that the ratio is free of bias. Those are causal assumptions, not bookkeeping checks.

IVW Estimation and Heterogeneity

For \(K\) independent variants, the standard first summary estimate is IVW. In the fixed-effect form used here, it is a weighted regression of outcome associations on exposure associations constrained to pass through zero. Let \(SE(\hat{\beta}_{Yj})\) be the standard error of the outcome association, and set \(w_j=1/SE(\hat{\beta}_{Yj})^2\). Treating the exposure associations as fixed gives:

$$ \hat{\theta}_{IVW} = \frac{\sum_{j=1}^{K} w_j\hat{\beta}_{Xj}\hat{\beta}_{Yj}} {\sum_{j=1}^{K} w_j\hat{\beta}_{Xj}^{\,2}}, \qquad SE(\hat{\theta}_{IVW}) = \frac{1}{\sqrt{\sum_{j=1}^{K} w_j\hat{\beta}_{Xj}^{\,2}}}. $$

These expressions use the usual approximation that uncertainty in the exposure associations is negligible relative to uncertainty in the outcome associations (often called the NOME approximation). They also rely on correctly aligned associations and, for the stated standard error, independent variants and the specified fixed-effect model. If variants are correlated, the covariance between their association estimates must be accounted for rather than treating the weights as independent.

The IVW estimate is a precision-weighted summary, not a guarantee that every variant is a valid instrument. A useful check is Cochran’s \(Q\), the weighted sum of squared residuals around the fitted IVW line. Under the common-slope model with independent variants and appropriate standard errors, \(Q\) is compared approximately with a chi-squared distribution with \(K-1\) degrees of freedom. A large value indicates that residual differences are greater than expected from the stated sampling errors alone. It does not identify their cause.

Worked Example: IVW Estimate, Interval, and Cochran’s Q

Consider four hypothetical, independent variants. The table gives harmonized associations; all outcome standard errors are \(0.02\) SD per allele.

Variant\(\hat{\beta}_{Xj}\) (SD)\(\hat{\beta}_{Yj}\) (SD)Outcome SE (SD)
A0.100.050.02
B0.080.020.02
C0.120.070.02
D0.090.120.02

Each weight is \(1/0.02^2=2500\). Since the weights are equal, they cancel from the ratio:

$$ \hat{\theta}_{IVW} = \frac{0.10(0.05)+0.08(0.02)+0.12(0.07)+0.09(0.12)} {0.10^2+0.08^2+0.12^2+0.09^2} = \frac{0.0258}{0.0389} = 0.6632. $$

The conventional standard error is \(1/\sqrt{2500(0.0389)}=0.1014\) SD of outcome per SD of exposure. A normal-approximation 95% interval is \(0.6632\pm1.96(0.1014)\), or approximately \(0.4645\) to \(0.8620\). Under the model used for this interval, the data are compatible with effects in this range; it is not a 95% probability statement about the fixed causal parameter.

For \(Q\), the fitted values are \(\hat{\theta}_{IVW}\hat{\beta}_{Xj}\), and \(Q=\sum_j[(\hat{\beta}_{Yj}-\hat{\theta}_{IVW}\hat{\beta}_{Xj})/0.02]^2\). The four residuals before division by \(0.02\) are approximately \(-0.01632\), \(-0.03306\), \(-0.009589\), and \(0.06031\). Thus, \(Q\approx[(-0.01632)^2+(-0.03306)^2+(-0.009589)^2+(0.06031)^2]/0.0004=12.72\). With \(df=4-1=3\), the chi-squared upper-tail p-value is approximately \(0.0053\). This is evidence of excess between-variant dispersion relative to the fixed-effect model, not proof that a particular variant is invalid.

Why IVW Has This Form

The IVW formula follows by minimizing the weighted residual sum of squares for a line constrained to pass through zero. Write that sum as \(S(\theta)=\sum_j w_j(\hat{\beta}_{Yj}-\theta\hat{\beta}_{Xj})^2\). Differentiating and setting the derivative to zero gives:

$$ \frac{dS(\theta)}{d\theta} = -2\sum_j w_j\hat{\beta}_{Xj} (\hat{\beta}_{Yj}-\theta\hat{\beta}_{Xj})=0, \qquad \hat{\theta} = \frac{\sum_j w_j\hat{\beta}_{Xj}\hat{\beta}_{Yj}} {\sum_j w_j\hat{\beta}_{Xj}^{\,2}}. $$

Because the second derivative is \(2\sum_jw_j\hat{\beta}_{Xj}^{\,2}>0\) when at least one exposure association is nonzero, this stationary point minimizes \(S(\theta)\). The same residual sum at the fitted value is \(Q\). Fitting one slope uses one degree of freedom, which gives \(K-1\) residual degrees of freedom under the common-slope model.

Pleiotropy-Robust Sensitivity Estimates

A sensitivity estimate changes the assumptions or the way information is combined; it does not make the causal problem disappear. The weighted median and MR-Egger illustrate two different approaches. Their estimates can help diagnose dependence on the IVW assumptions, but each has its own conditions.

Definition: The weighted-median estimate is the median of the variant-specific ratio estimates when each ratio is weighted by its precision. It is consistent if more than 50% of the total weight comes from valid instruments. MR-Egger estimates a weighted regression with a freely estimated intercept: \(\hat{\beta}_{Yj}=\alpha+\theta_{Egger}\hat{\beta}_{Xj}+\text{error}_j\). Its slope can be consistent under the InSIDE assumption (Instrument Strength Independent of Direct Effect), alongside the other necessary MR conditions. The intercept represents an average directional pleiotropic contribution under the model; it is not a universal test that instruments are valid.

Worked Example: Comparing Sensitivity Estimates

Use the four harmonized variants above. Their ratio estimates are \(0.05/0.10=0.500\), \(0.02/0.08=0.250\), \(0.07/0.12=0.5833\), and \(0.12/0.09=1.333\). With equal outcome standard errors, approximate inverse-variance weights for these ratios are proportional to \(\hat{\beta}_{Xj}^{\,2}\), giving weights \(25,\ 16,\ 36,\ 20.25\) after division by the common factor \(0.02^2\). The total is \(97.25\); half is \(48.625\).

In ascending ratio order, the cumulative weights are \(16\) at \(0.250\), \(41\) at \(0.500\), and \(77\) at \(0.5833\). The weighted median is therefore \(0.5833\), because the cumulative weight first passes half the total at that ratio. This estimate is less sensitive than IVW to a minority of invalid weight, but its protection depends on the more-than-half-valid-weight condition.

For MR-Egger with the same equal outcome standard errors, the weighted line is ordinary least squares with an intercept. The means are \(\bar{\beta}_X=0.0975\) and \(\bar{\beta}_Y=0.0650\). The centered sums are \(S_{XX}=0.000875\) and \(S_{XY}=0.000450\), so the slope is \(S_{XY}/S_{XX}=0.5143\). The intercept is \(0.0650-0.5143(0.0975)=0.01486\) SD of outcome per allele. There are only four variants, so the Egger slope is highly imprecise; under the fixed outcome-SE calculation its standard error is \(0.02/\sqrt{0.000875}=0.676\). The point estimate alone should not be treated as a precise correction for pleiotropy.

The IVW estimate \(0.6632\), weighted-median estimate \(0.5833\), and MR-Egger slope \(0.5143\) are not identical, while \(Q\) is large. Together these results flag sensitivity to instrument-level differences. They do not establish which estimate is closest to a causal effect: in particular, the median’s validity condition and Egger’s InSIDE assumption cannot be verified from these four summary estimates alone.

Diagnostics, Alternatives, and Limits

A sensible analysis checks data and assumptions alongside the point estimates. Confirm that effect alleles are aligned, units and phenotype scales match, and variants are independent or that their covariance is handled. Examine instrument strength and uncertainty in \(\hat{\beta}_{Xj}\); if exposure-association uncertainty is consequential, the simple IVW formula can be biased or too optimistic. Check heterogeneity and consider whether an influential variant drives the result. A large \(Q\), a large change after removing an influential variant, or substantial disagreement among estimators should prompt investigation rather than selection of whichever number is most appealing.

ApproachStrengthKey limitation
IVWEfficient when the common causal-effect model and instrument assumptions are appropriate.Can be biased if instrument direct effects violate the model; heterogeneity does not reveal its source.
Weighted medianCan remain consistent when invalid instruments contribute less than half the total weight.Fails if the valid instruments do not supply more than half the weight.
MR-EggerAllows an average directional pleiotropic component through an intercept.Often imprecise and relies on InSIDE; a nonzero or nonsignificant intercept does not settle validity.

These approaches are not interchangeable votes. The weighted median and MR-Egger answer under different assumptions, and neither is guaranteed to correct a poorly harmonized data set, weak instruments, correlated variants treated as independent, or violations of independence. In this example, the IVW interval is a conventional model-based interval; excess heterogeneity and possible pleiotropy mean it should not be read as if the causal assumptions had been demonstrated. If the outcome were binary, interpretation would also depend on the outcome scale and link function; the present calculations are for a continuous outcome.

Common Mistake

Common pitfall: “The IVW p-value is small, so the genetic variants prove that increasing the exposure causes the outcome to change by the estimated amount.” A small p-value does not establish instrument validity or prove causation. It summarizes incompatibility with a specified null under a statistical model. The causal interpretation additionally depends on relevance, independence, exclusion restriction, adequate harmonization, and the other modeling conditions. Here, the large \(Q\) is a reason to be especially cautious, not a reason to treat the precise-looking IVW estimate as definitive.

The practical conclusion is conditional: under the stated assumptions, IVW estimates an increase of about \(0.66\) SD in outcome per SD increase in exposure, but the substantial heterogeneity and differing sensitivity estimates make the causal interpretation uncertain. A responsible reading keeps the estimate, its uncertainty, the diagnostics, and the assumptions together.

Check Your Understanding

Answer each question, then compare with the worked solutions below.

  1. If an outcome association is \(-0.03\) per the opposite allele to the exposure effect allele, what harmonized association should be used?
  2. Why does the fixed-effect IVW heterogeneity statistic have \(K-1\) degrees of freedom?
  3. For the four variants in the example, which variant has the largest ratio estimate, and what does the large \(Q\) tell you?
  4. State the condition that protects the weighted-median estimate against some invalid instruments.
  5. Why is the MR-Egger slope in the example not strong evidence for a specific causal effect?

Solutions. (1) Use \(+0.03\), because reversing the effect allele reverses the sign. (2) There are \(K\) residual contributions and one fitted common slope, leaving \(K-1\) degrees of freedom under the model. (3) Variant D has ratio \(0.12/0.09=1.333\), the largest. \(Q\approx12.72\) with \(df=3\) signals excess dispersion relative to the fixed-effect common-slope model, but does not identify its cause or a particular invalid variant. (4) More than 50% of the total ratio-estimate weight must come from valid instruments. (5) With only four variants, the slope’s standard error is about \(0.676\), large relative to its estimate, and consistency also depends on assumptions such as InSIDE.

Clinical Biostats