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.
/plugin marketplace add choxos/BiostatAgent/plugin install choxos-itc-modeling-plugins-itc-modeling@choxos/BiostatAgentThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Comprehensive methodological guidance for conducting rigorous Multilevel Network Meta-Regression following NICE DSU guidance and multinma package documentation.
Network Structure
Population Differences
Target Population
| 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) |
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
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
Discrete approximation to the integral over AgD population:
# Specify covariate distribution
add_integration(
network,
age = distr(qnorm, mean = 62, sd = 10),
sex = distr(qbinom, prob = 0.55),
n_int = 500
)
# Creates 500 "pseudo-individuals" sampled from
# the specified covariate distribution
| 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.
# Continuous: Normal distribution
age = distr(qnorm, mean = 62, sd = 10)
# Binary: Bernoulli (using binomial with size=1)
sex = distr(qbinom, prob = 0.55)
# Categorical: Discrete distribution
# May need special handling
# Correlated covariates: Copula methods
# More complex setup required
nma(
network,
regression = ~ age + sex + age:sex, # Covariate effects
...
)
# Interprets as:
# Linear predictor = trt_effect + β_age × age + β_sex × sex + β_age:sex × age × sex
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
nma(
...,
prior_intercept = prior_normal(0, 10), # Baseline risk
prior_trt = prior_normal(0, 5), # Treatment effects
prior_reg = prior_normal(0, 2), # Regression coefficients
prior_het = prior_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
# Predict to target population
target <- data.frame(
age = seq(50, 80, 5),
sex = 0.5 # 50% male
)
predictions <- predict(fit, newdata = target)
For non-collapsible effect measures (OR, HR):
# Fit node-split model
nodesplit_fit <- nma(
network,
consistency = "nodesplit",
...
)
# Check for direct vs indirect disagreement
summary(nodesplit_fit)
rank_probs <- posterior_rank_probs(fit)
# Returns probability matrix:
# P(treatment j has rank r)
Same as standard NMA:
# Method 1: Point prediction
target <- data.frame(age = 62, sex = 0.5)
# Method 2: Distribution prediction
# Provide many points representing target distribution
target <- data.frame(
age = rnorm(1000, 60, 12),
sex = rbinom(1000, 1, 0.45)
)
# Relative effects (log scale)
predict(fit, type = "link")
# Relative effects (natural scale)
predict(fit, type = "response")
# Absolute outcomes
predict(fit, type = "response", baseline = ...)
# 1. Print summary (shows R-hat, ESS)
print(fit)
# 2. Trace plots
plot(fit, pars = "d")
# 3. R-hat should be < 1.05
# 4. ESS should be > 400 per parameter
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(qbinom, prob = sex_prop),
n_int = 500
)
# 5. Fit ML-NMR
fit <- nma(
network,
trt_effects = "random",
regression = ~ age + sex,
prior_intercept = prior_normal(0, 10),
prior_trt = prior_normal(0, 5),
prior_reg = prior_normal(0, 2),
prior_het = prior_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", ...)
This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.