Tutorials › Statistical Genetics › Worked Two-Sample MR Analysis Of A Continuous Exposure

Mendelian Randomization Foundations · Tutorial 851 of 989

Worked Two-Sample MR Analysis Of A Continuous Exposure

Follow a hypothetical analysis from exposure-associated variants to an inverse-variance weighted estimate, then interpret its uncertainty and causal meaning.

Advanced 11 min read

What You'll Learn

  • Apply exposure-GWAS significance and linkage-disequilibrium criteria to select instruments
  • Align exposure and outcome effects to the same effect allele
  • Calculate single-variant Wald ratios and a multi-variant IVW estimate
  • Derive the IVW standard error and calculate a confidence interval and p-value
  • Interpret the estimate in exposure and outcome units under explicit MR assumptions

From Summary Data to a Causal Estimate

A two-sample Mendelian randomization (MR) analysis combines genetic associations estimated in two samples: variant–exposure associations from one study and variant–outcome associations from another. The calculation is often compact, but its meaning depends on a sequence of choices. Variants must be relevant to the exposure, the same effect allele must be used for both associations, and the uncertainty calculation must match the estimator.

The worked analysis below uses a continuous exposure measured in standard deviation (SD) units and a binary disease outcome. The outcome associations are on the log-odds scale. Thus, the final estimate is a change in disease log odds per one-SD increase in the exposure; exponentiating it gives an odds ratio. All data are hypothetical.

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, both defined for the same effect allele. With a continuous exposure, the single-variant Wald ratio is \(\hat{\beta}_{Yj}/\hat{\beta}_{Xj}\). When outcome associations are log odds, this ratio is the estimated change in disease log odds per one-unit increase in the exposure.

Selecting and Aligning Variants

Instrument selection begins with an exposure genome-wide association study (GWAS). A common design selects variants associated with the exposure at a prespecified threshold, such as \(p<5\times10^{-8}\), and then uses linkage disequilibrium (LD) clumping to retain variants that are approximately independent. The outcome study is used to obtain associations for the selected variants, not to choose whichever variants produce a desired outcome result. Selection and clumping decisions should be made consistently with the study design.

Harmonization ensures that each pair of associations refers to the same effect allele. If the exposure association is reported for allele G and the outcome association for allele A at a G/A variant, the outcome coefficient and its allele frequency must be converted to the G effect allele: the coefficient changes sign, while its standard error does not. Otherwise, a genuinely positive ratio can appear negative simply because the reported alleles differ. Palindromic variants require particular care because their allele pair is its own complement; when strand orientation cannot be resolved reliably, an ambiguous variant should not be used as though it were aligned.

Worked Example: Selecting and Harmonizing Three Instruments

Suppose an exposure GWAS reports the following hypothetical candidates. The exposure effects are per allele and the exposure is measured in SD units.

VariantExposure effect allele\(\hat{\beta}_{Xj}\) (SE)Exposure-GWAS p-valueDecision
rs101A0.10 (0.02)\(2\times10^{-9}\)Retain
rs205G0.08 (0.02)\(4\times10^{-10}\)Retain
rs319T0.12 (0.03)\(7\times10^{-9}\)Retain
rs411C0.05 (0.01)\(3\times10^{-7}\)Exclude

At the \(5\times10^{-8}\) threshold, rs101, rs205, and rs319 qualify; rs411 does not. Suppose LD clumping shows that the three qualifying variants are sufficiently independent for ordinary IVW analysis. The outcome GWAS reports rs101 for A with \(\hat{\beta}_{Y1}=0.06\) and \(SE=0.02\), rs205 for A with \(\hat{\beta}_{Y2}=-0.04\) and \(SE=0.02\), and rs319 for T with \(\hat{\beta}_{Y3}=0.08\) and \(SE=0.03\). The rs101 and rs319 outcome effects are already aligned. For rs205, the outcome effect allele A is opposite to the exposure effect allele G, so flip the sign:

$$ \hat{\beta}_{Y2,\text{aligned}}=-(-0.04)=0.04,\qquad SE(\hat{\beta}_{Y2,\text{aligned}})=0.02. $$

The harmonized outcome effects are therefore 0.06, 0.04, and 0.08, all for the corresponding exposure effect alleles. A sign change does not change the standard error. These are the three variants used in the calculations that follow.

Wald Ratios and the IVW Estimate

For one valid genetic instrument, the Wald ratio divides the variant–outcome association by the variant–exposure association. With several independent variants, the inverse-variance weighted (IVW) estimator combines their information by fitting a weighted regression through the origin. In the usual first-order summary-data calculation, the exposure associations are treated as fixed and the weights are the inverse variances of the outcome associations.

$$ \hat{\theta}_{\mathrm{IVW}} = \frac{\displaystyle\sum_{j=1}^{J} \hat{\beta}_{Xj}\hat{\beta}_{Yj}/SE(\hat{\beta}_{Yj})^2} {\displaystyle\sum_{j=1}^{J} \hat{\beta}_{Xj}^{\,2}/SE(\hat{\beta}_{Yj})^2}. $$

Here, \(\hat{\theta}_{\mathrm{IVW}}\) is the estimated change in outcome log odds per one-unit increase in the exposure. Each variant’s ratio contributes in proportion to its precision and the size of its exposure association. IVW is not simply the unweighted average of the individual ratios.

Worked Example: Calculating the Three Wald Ratios

Using the aligned estimates from the selection example, calculate each ratio as \(\hat{\beta}_{Yj}/\hat{\beta}_{Xj}\):

$$ \text{rs101: } \frac{0.06}{0.10}=0.600,\qquad \text{rs205: } \frac{0.04}{0.08}=0.500,\qquad \text{rs319: } \frac{0.08}{0.12}=0.667. $$

These hypothetical single-variant estimates range from 0.500 to 0.667 log-odds units per one-SD increase in exposure. Their differences may reflect sampling variation, or violations of assumptions; the ratios alone do not establish which explanation is correct. For the combined estimate, use the specified IVW calculation rather than selecting one ratio because it is largest or smallest.

Worked Example: Computing the IVW Estimate

For the same three variants, the outcome standard errors are 0.02, 0.02, and 0.03. The corresponding inverse-variance weights are \(1/0.02^2=2500\), \(2500\), and \(1/0.03^2=1111.11\). Substituting into the IVW formula gives:

$$ \hat{\theta}_{\mathrm{IVW}} = \frac{ 2500(0.10)(0.06)+2500(0.08)(0.04)+1111.11(0.12)(0.08) }{ 2500(0.10)^2+2500(0.08)^2+1111.11(0.12)^2 } = \frac{15+8+10.6667}{25+16+16} = \frac{33.6667}{57} = 0.5906. $$

The estimate is 0.5906 log-odds units per one-SD increase in the exposure. It is between the three ratios, as expected for a positively weighted combination, but it is not their simple arithmetic mean: the IVW weights arise from the weighted regression, and the exposure-association sizes also enter the formula.

Uncertainty: Standard Error, Interval, and Test

Under the first-order model, suppose the aligned outcome estimates are independent and approximately normally distributed, with variances given by their squared standard errors. Treat the exposure estimates as fixed for this calculation. The IVW estimator is then a weighted least-squares slope through the origin. Its information is the sum of squared exposure associations divided by outcome variances. The standard error is the square root of the reciprocal information.

Result: With independent outcome-association errors and exposure associations treated as fixed, the first-order IVW standard error is $$ SE(\hat{\theta}_{\mathrm{IVW}}) = \sqrt{\frac{1}{\displaystyle\sum_{j=1}^{J} \hat{\beta}_{Xj}^{\,2}/SE(\hat{\beta}_{Yj})^2}}. $$

To justify the formula, write the weighted residual sum of squares as \(L(\theta)=\sum_j(\hat{\beta}_{Yj}-\theta\hat{\beta}_{Xj})^2/SE(\hat{\beta}_{Yj})^2\). Differentiating and setting the derivative to zero gives the IVW estimate. The weighted-regression information is \(\sum_j\hat{\beta}_{Xj}^{\,2}/SE(\hat{\beta}_{Yj})^2\), whose reciprocal is the conditional variance. The curvature of \(L(\theta)\) is twice that information; it is not the information itself.

Worked Example: Calculating the Interval and P-Value

For the three-variant estimate, the information is the IVW denominator already calculated, 57. Thus:

$$ SE(\hat{\theta}_{\mathrm{IVW}})=\sqrt{\frac{1}{57}}=0.1325. $$

A normal-approximation 95% confidence interval on the log-odds scale is the estimate plus or minus 1.96 standard errors:

$$ 0.5906\pm1.96(0.1325) = 0.5906\pm0.2597 = (0.3309,\ 0.8503). $$

For the two-sided test \(H_0:\theta=0\) against \(H_a:\theta\ne0\), the test statistic using the unrounded estimate and standard error is approximately \(0.5906433/0.1324532=4.459\). The normal-approximation p-value is about \(8.2\times10^{-6}\). This p-value is the probability, under the null and the stated sampling model, of obtaining a test statistic at least as extreme as the observed one. It is not the probability that the null is true.

Exponentiating the estimate and confidence limits converts them to odds-ratio scale:

$$ \exp(0.5906)=1.805,\qquad \bigl(\exp(0.3311),\exp(0.8502)\bigr)=(1.392,\ 2.340). $$

Under the MR assumptions, the estimate corresponds to an odds ratio of about 1.81 for disease per one-SD increase in the exposure, with a normal-approximation 95% confidence interval from about 1.39 to 2.34. The interval procedure has 95% coverage over repeated samples under its model; it does not assign a 95% probability to this particular interval containing a fixed parameter.

Assumptions and Causal Interpretation

The arithmetic produces an association-based estimate. Calling it causal requires the instrument assumptions. The selected variants must be associated with the exposure (relevance), independent of factors that confound the exposure–outcome relation (independence), and affect the outcome only through the exposure (exclusion restriction). The variants must also be aligned correctly, and the ordinary IVW calculation above relies on their being independent, or sufficiently close to independent for the stated variance calculation. With a continuous exposure and log-odds outcome, the reported unit is log odds per exposure unit; exponentiation gives the corresponding odds ratio.

The numerical standard error shown is a first-order one: it uses the outcome-association standard errors and treats the exposure-association estimates as fixed. This is most defensible when instruments are sufficiently strong. It does not account for every source of uncertainty, such as uncertainty in exposure associations. A small p-value and a confidence interval excluding the null do not verify the instrument assumptions. They quantify sampling uncertainty under the calculation’s model; the causal interpretation remains conditional on the assumptions.

The analysis matters because each step can alter the result before any causal interpretation is considered. A sign error in harmonization can reverse a ratio; an inappropriate variant set can change the target and precision; and a carefully calculated interval cannot compensate for invalid instruments. The final estimate should therefore be reported alongside its units, uncertainty method, variant-selection and alignment decisions, and the assumptions that give it causal meaning.

Common pitfall: “The outcome estimate has the opposite sign, so this variant suggests a protective effect.” That conclusion is not justified until effect alleles are aligned. If the outcome association is reported for the allele opposite to the exposure effect allele, flip the outcome coefficient’s sign before calculating the ratio; otherwise, the apparent direction may be an allele-coding artifact.

Check Your Understanding

Use the definitions and calculations above to check the steps in a two-sample analysis.

  1. A variant has an exposure effect of 0.09 for allele C. The outcome GWAS reports an effect of \(-0.03\) for allele T at a C/T variant. What aligned outcome effect should be used for the ratio?
  2. Why does the standard error of an outcome association stay the same when its effect allele is reversed?
  3. In the IVW formula, why is the combined estimate not generally the unweighted mean of the individual Wald ratios?
  4. State the assumptions that allow an IVW association estimate to be interpreted causally.
  5. What does the first-order IVW confidence interval quantify, and why does it not establish that the instruments are valid?
Clinical Biostats