AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Ml Nmr Methodology

skill-choxos-biostatagent-ml-nmr-methodology · by choxos

Deep methodology knowledge for ML-NMR including IPD/AgD integration, population adjustment, numerical integration, and prediction to target populations. Use when conducting or reviewing ML-NMR analyses.

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

Install

$ agentstack add skill-choxos-biostatagent-ml-nmr-methodology

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

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-choxos-biostatagent-ml-nmr-methodology)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
3mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Ml Nmr Methodology? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

ML-NMR Methodology

Comprehensive methodological guidance for conducting rigorous Multilevel Network Meta-Regression following NICE DSU guidance and multinma package documentation.

When to Use This Skill

  • Deciding whether ML-NMR is appropriate
  • Setting up integration points for AgD
  • Specifying priors and models
  • Understanding marginal vs conditional effects
  • Predicting to target populations
  • Reviewing ML-NMR code or results

When to Use ML-NMR

ML-NMR is Appropriate When:

  1. Network Structure
  • Multiple treatments form (partial) network
  • Some studies have IPD, others only AgD
  • Want to leverage all available evidence
  1. Population Differences
  • Effect modifiers differ across populations
  • Standard NMA transitivity violated
  • Need population-adjusted estimates
  1. Target Population
  • Want predictions for specific population
  • Different from any single trial population
  • Policy-relevant population definition

ML-NMR vs Alternatives

| Scenario | Recommended Method | |----------|-------------------| | All AgD, similar populations | Standard NMA | | All AgD, different populations | NMA meta-regression | | IPD for one study, AgD for one | MAIC or STC | | IPD + AgD network | ML-NMR | | Disconnected with IPD | ML-NMR (with assumptions) |

Key Concepts

Individual-Level vs Study-Level

ML-NMR Models Both:
├── Individual-level (within IPD studies)
│   - Patient-level outcomes
│   - Patient-level covariates
│   - Exact covariate-outcome relationships
│
└── Study-level (for AgD studies)
    - Aggregate outcomes
    - Covariate summaries
    - Integration over covariate distribution

Population Adjustment

Problem: AgD studies provide aggregate summaries, but we need individual-level predictions.

Solution: Numerical integration over the AgD population's covariate distribution.

For AgD study:
Expected outcome = ∫ f(outcome | covariates, treatment) × p(covariates) d(covariates)

Where:
- f(): Individual-level outcome model (from IPD)
- p(): Covariate distribution in AgD population

Integration Points

What Are Integration Points?

Discrete approximation to the integral over AgD population:

# Specify covariate distribution
add_integration(
  network,
  age = distr(qnorm, mean = 62, sd = 10),
  sex = distr(qbern, prob = 0.55),
  n_int = 500
)

# Creates 500 "pseudo-individuals" sampled from
# the specified covariate distribution

Choosing Number of Integration Points

| Complexity | n_int | Description | |------------|-------|-------------| | Simple | 100-200 | 1-2 covariates, linear effects | | Moderate | 300-500 | 2-3 covariates, typical use | | Complex | 500-1000 | Many covariates, interactions | | Very complex | 1000+ | Nonlinear effects, many variables |

Best Practice: Test sensitivity to n_int by running with different values.

Specifying Distributions

# Continuous: Normal distribution
age = distr(qnorm, mean = 62, sd = 10)

# Binary: Bernoulli
sex = distr(qbern, prob = 0.55)

# Categorical: Discrete distribution
# May need special handling

# Correlated covariates: Copula methods
# More complex setup required

Model Specification

Regression Component

nma(
  network,
  regression = ~ age + sex + age:sex,  # Covariate effects
  ...
)

# Interprets as:
# Linear predictor = trt_effect + β_age × age + β_sex × sex + β_age:sex × age × sex

Effect Modifier vs Prognostic Factor

In ML-NMR regression formula:
├── Effect modifiers: Interact with treatment
│   - regression = ~ age
│   - Creates age × treatment interaction
│
└── Prognostic factors: Affect baseline risk only
    - Handled through study random effects
    - Or explicit prognostic regression

Prior Specification

nma(
  ...,
  prior_intercept = normal(0, 10),    # Baseline risk
  prior_trt = normal(0, 5),           # Treatment effects
  prior_reg = normal(0, 2),           # Regression coefficients
  prior_het = half_normal(1)          # Heterogeneity
)

# Considerations:
# - Scale depends on link function
# - Log-odds: 2-3 is large effect
# - Informative priors from Turner et al. for het

Marginal vs Conditional Effects

Conditional Effects

  • Effect at specific covariate values
  • "Effect for a 65-year-old male"
  • Directly from model coefficients

Marginal (Population-Averaged) Effects

  • Effect averaged over population
  • "Average effect in UK population"
  • Obtained via integration
# Predict to target population
target  400 per parameter

Addressing Convergence Issues

  1. Increase iterations: More warmup/sampling
  2. Adjust adapt_delta: Higher (0.95, 0.99) for divergences
  3. Reparameterize: Different model specifications
  4. Informative priors: If posterior too diffuse
  5. Check data: Sparse comparisons cause issues

Reporting Requirements

Methods

  • [ ] Network structure description
  • [ ] IPD vs AgD studies identified
  • [ ] Covariate selection for adjustment
  • [ ] Integration point specification
  • [ ] Prior specification with justification
  • [ ] Target population definition
  • [ ] Convergence criteria

Results

  • [ ] Network diagram
  • [ ] Convergence diagnostics (R-hat, ESS)
  • [ ] Relative effects for all comparisons
  • [ ] Treatment rankings with uncertainty
  • [ ] Consistency assessment
  • [ ] Predictions to target population
  • [ ] Sensitivity analyses

Common Pitfalls

1. Insufficient Integration Points

  • Results may be unstable
  • Check sensitivity to n_int
  • Increase until results stabilize

2. Ignoring Convergence

  • Must check R-hat and ESS
  • Divergent transitions indicate problems
  • Don't trust results without convergence

3. Wrong Covariate Distributions

  • Must match AgD population
  • Extract from publications carefully
  • Consider correlation between covariates

4. Misinterpreting Marginal Effects

  • Non-collapsible measures need care
  • OR/HR: Marginal ≠ conditional
  • Use predict() for proper marginalization

5. Not Specifying Target Population

  • Default may not be policy-relevant
  • Explicitly define target
  • Sensitivity to target specification

Quick Reference Code

library(multinma)

# 1. Set up IPD studies
ipd_net <- set_ipd(ipd_data,
                   study = study, trt = treatment, r = response)

# 2. Set up AgD studies
agd_net <- set_agd_arm(agd_data,
                       study = study, trt = treatment,
                       r = responders, n = sampleSize)

# 3. Combine network
network <- combine_network(ipd_net, agd_net)

# 4. Add integration points
network <- add_integration(
  network,
  age = distr(qnorm, mean = age_mean, sd = age_sd),
  sex = distr(qbern, prob = sex_prop),
  n_int = 500
)

# 5. Fit ML-NMR
fit <- nma(
  network,
  trt_effects = "random",
  regression = ~ age + sex,
  prior_intercept = normal(0, 10),
  prior_trt = normal(0, 5),
  prior_reg = normal(0, 2),
  prior_het = half_normal(1),
  adapt_delta = 0.95,
  chains = 4,
  iter = 4000,
  warmup = 2000,
  seed = 12345
)

# 6. Check convergence
print(fit)

# 7. Relative effects
rel_eff <- relative_effects(fit)
plot(rel_eff)

# 8. Rankings
ranks <- posterior_rank_probs(fit)
plot(ranks)

# 9. Predict to target
target <- data.frame(age = 60, sex = 0.5)
pred <- predict(fit, newdata = target)

# 10. Node-splitting
nodesplit_fit <- nma(network, consistency = "nodesplit", ...)

Resources

  • NICE DSU TSD 18: Population-adjusted comparisons
  • Phillippo et al. (2020): ML-NMR methods paper
  • multinma package: https://dmphillippo.github.io/multinma/
  • Stan User's Guide (for MCMC diagnostics)

Source & license

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

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.