AgentStack
SKILL verified MIT Self-run

Mendelian Randomization

skill-choxos-biostatagent-mendelian-randomization · by choxos

Mendelian randomization in R, including instrument selection, two-sample MR, pleiotropy checks, and sensitivity analysis.

No reviews yet
0 installs
12 views
0.0% view→install

Install

$ agentstack add skill-choxos-biostatagent-mendelian-randomization

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Mendelian Randomization? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Mendelian Randomization in R

Overview

Mendelian randomization (MR) methods for causal inference using genetic variants as instrumental variables. Covers instrument selection, two-sample MR, sensitivity analyses, pleiotropy assessment, multivariable MR, and advanced methods for robust causal inference.

Instrument Selection

Using TwoSampleMR

library(TwoSampleMR)

# Extract instruments from GWAS database
# IEU Open GWAS Project
exposure_dat 
  filter(pval.exposure  10 indicates strong instruments

calculate_f_stat 
  filter(abs(b - results$b[results$method == "Inverse variance weighted"]) >
         2 * results$se[results$method == "Inverse variance weighted"])

MR-PRESSO

library(MRPRESSO)

# MR-PRESSO for outlier detection
presso 
  filter(pval_exp 
  pull(snp)

# Fit CAUSE
cause_result  Y
forward_results  X
# Extract instruments for outcome
outcome_instruments  Y", "Y -> X"),
  Beta = c(forward_results$b[1], reverse_results$b[1]),
  SE = c(forward_results$se[1], reverse_results$se[1]),
  P = c(forward_results$pval[1], reverse_results$pval[1])
)
print(comparison)

Reporting Results

# Create comprehensive MR report
create_mr_report 
      select(method, nsnp, b, se, pval) |>
      mutate(
        or = exp(b),
        ci_lower = exp(b - 1.96 * se),
        ci_upper = exp(b + 1.96 * se)
      ),
    heterogeneity = het,
    pleiotropy = pleiotropy,
    f_statistic = mean(dat$f_stat, na.rm = TRUE)
  )

  return(report)
}

# Generate report
mr_report  10 for all instruments
2. **Multiple methods**: Report IVW, MR-Egger, weighted median, and MR-PRESSO
3. **Sensitivity analyses**: Always check heterogeneity, pleiotropy, and leave-one-out
4. **Steiger filtering**: Assess support for the assumed direction; it does not prove direction
5. **Visualization**: Include scatter, forest, and funnel plots
6. **Bidirectional**: Consider reverse causation when biologically plausible
7. **Biological plausibility**: Interpret results in biological context
8. **Reporting**: Follow STROBE-MR guidelines

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [choxos](https://github.com/choxos)
- **Source:** [choxos/BiostatAgent](https://github.com/choxos/BiostatAgent)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.