Skip to contents

Takes the pooled profile log-likelihood from poolLikelihoodProfiles and the instrument table to compute the MR causal estimate via the Wald ratio. The SNP-outcome association (beta_ZY) is estimated from the profile likelihood peak, and the causal estimate is beta_MR = beta_ZY / beta_ZX. For multi-SNP analyses, beta_ZX is the association of the exact weighted allele score used at each site, not a simple mean of the component SNP effects. Uncertainty is propagated using the delta method.

Confidence intervals are computed both from the profile likelihood (likelihood ratio method) and via the delta method (normal approximation). The likelihood- based CI is preferred as it does not assume normality.

Usage

computeMREstimate(combinedProfile, instrumentTable, ciLevel = 0.95)

Arguments

combinedProfile

Output of poolLikelihoodProfiles.

instrumentTable

Data frame. Output of getMRInstruments. Used as a fallback for beta_ZX and se_ZX values when the pooled profile does not carry a stored score definition.

ciLevel

Numeric. Confidence interval level. Default is 0.95.

Value

A list with class "medusaMREstimate" containing:

betaZY

Point estimate of SNP-outcome association (profile MLE).

seZY

Standard error of betaZY from profile curvature.

betaMR

Causal effect estimate: betaZY / betaZX.

seMR

Standard error of betaMR via delta method.

ciLower

Lower confidence limit for betaMR.

ciUpper

Upper confidence limit for betaMR.

pValue

Two-sided p-value for betaMR.

oddsRatio

Exp(betaMR) — causal odds ratio for binary outcomes.

orCiLower

Lower CI for odds ratio.

orCiUpper

Upper CI for odds ratio.

ciLevel

The confidence level used.

betaZX

The exposure effect of the fitted allele score.

seZX

The SE of betaZX used.

nInstruments

Number of instruments used.

combinedProfile

The full combined profile for plotting.

Details

Compute Mendelian Randomization Causal Estimate

Wald ratio: For a single instrument, beta_MR = beta_ZY / beta_ZX. When multiple instruments are pooled into a single allele score, the denominator must be the exposure effect of that same score: $$\beta_{ZX, score} = \sum_j w_j \gamma_j$$ where \(w_j\) are the fixed score weights used at the sites and \(\gamma_j\) are the SNP-exposure coefficients.

Delta method SE: se_MR = sqrt( (se_ZY/beta_ZX)^2 + (beta_ZY * se_ZX / beta_ZX^2)^2 ).

Likelihood-based CI: The region of betaZY values where the log-likelihood does not drop below peak - qchisq(ciLevel, df=1)/2. This CI is then transformed to the MR scale via division by beta_ZX.

References

Burgess, S., Butterworth, A., & Thompson, S. G. (2013). Mendelian randomization analysis with multiple genetic variants using summarized data. Genetic Epidemiology, 37(7), 658-665. doi:10.1002/gepi.21758. Open access: https://pmc.ncbi.nlm.nih.gov/articles/PMC4377079/

Examples

profiles <- simulateSiteProfiles(nSites = 3, trueBeta = 0.5)
combined <- poolLikelihoodProfiles(profiles)
#> Pooling profile likelihoods from 3 site(s)...
#> Pooling complete: 3 sites, 402 total cases, 5598 total controls.
instruments <- simulateInstrumentTable(nSnps = 5)
estimate <- computeMREstimate(combined, instruments)
#> MR estimate: beta = 1.3561 (95% CI: 0.7195, 1.9926), p = 6.42e-05
#> Odds ratio: 3.881 (95% CI: 2.054, 7.335)
print(estimate$betaMR)
#> [1] 1.356072