Install
$ agentstack add skill-choxos-biostatagent-ipd-meta-analysis ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo 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.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
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 →About
Individual Participant Data Meta-Analysis in R
Overview
Individual participant data (IPD) meta-analysis methods for synthesizing patient-level data across studies. Covers one-stage and two-stage approaches, mixed-effects models, combining IPD with aggregate data, treatment-covariate interactions, and handling missing data in multi-study settings.
Two-Stage IPD Meta-Analysis
Stage 1: Study-Level Analysis
library(dplyr)
library(purrr)
library(broom)
# IPD from multiple studies
ipd_data
group_by(study) |>
nest() |>
mutate(
model = map(data, ~lm(outcome ~ treatment + age, data = .x)),
tidy_model = map(model, tidy, conf.int = TRUE)
) |>
unnest(tidy_model) |>
filter(term == "treatment") |>
select(study, estimate, std.error, conf.low, conf.high)
print(study_results)
Stage 2: Meta-Analysis of Study Effects
library(metafor)
# Stage 2: Meta-analyze study-level estimates
ma_result
filter(term == "treatment")
Binary Outcomes
library(lme4)
# Logistic mixed-effects model
fit_logistic
group_by(study) |>
nest() |>
mutate(
model = map(data, ~lm(outcome ~ treatment, data = .x)),
results = map(model, ~tibble(
yi = coef(.x)["treatment"],
vi = vcov(.x)["treatment", "treatment"],
source = "IPD"
))
) |>
unnest(results) |>
select(study, yi, vi, source)
# Studies with only aggregate data
agd_studies
group_by(study) |>
mutate(
age_mean = mean(age), # Study-level mean
age_centered = age - age_mean # Individual deviation
) |>
ungroup()
# Model with separated effects
fit_interaction
group_by(age_group) |>
nest() |>
mutate(
model = map(data, ~lmer(outcome ~ treatment + (1 | study), data = .x)),
effect = map(model, ~fixef(.x)["treatment"])
) |>
unnest(effect)
Handling Missing Data
Multiple Imputation for IPD-MA
library(mice)
library(mitml)
# Multiple imputation accounting for clustering
# Use multilevel imputation methods
# Set up imputation
imp
mutate(outcome = if_else(.imp > 0 & is_missing, outcome + d, outcome))
# Analyze
fit <- lmer(outcome ~ treatment + age + (1 | study),
data = imp_adjusted)
tibble(
delta = d,
estimate = fixef(fit)["treatment"],
se = sqrt(vcov(fit)["treatment", "treatment"])
)
})
IPD Network Meta-Analysis
library(multinma)
# IPD-NMA with individual patient data
ipd_network <- set_ipd(
data = ipd_nma_data,
study = study,
trt = treatment,
y = outcome # Continuous outcome
)
# For binary outcome
ipd_network_bin <- set_ipd(
data = ipd_nma_data,
study = study,
trt = treatment,
r = events # Binary outcome
)
# Fit NMA
nma_ipd <- nma(
ipd_network,
trt_effects = "random",
prior_intercept = normal(scale = 10),
prior_trt = normal(scale = 10),
prior_het = half_normal(scale = 1)
)
summary(nma_ipd)
relative_effects(nma_ipd)
IPD-NMA with Covariate Adjustment
library(multinma)
# Population-adjusted NMA
nma_adj <- nma(
ipd_network,
trt_effects = "random",
regression = ~age + sex, # Covariate adjustment
class_interactions = "common"
)
# Predict effects for specific population
predict(nma_adj, newdata = data.frame(age = 65, sex = 1))
Diagnostics and Model Checking
Residual Analysis
library(lme4)
library(DHARMa)
# Fit model
fit <- lmer(outcome ~ treatment + age + (1 + treatment | study), data = ipd_data)
# Residual diagnostics
# Level 1 residuals (within-study)
resid_l1 <- residuals(fit, type = "pearson")
# Random effects
ranef_fit <- ranef(fit)$study
# DHARMa residual diagnostics
sim_res <- simulateResiduals(fit)
plot(sim_res)
# Check for heteroscedasticity
plot(fitted(fit), resid_l1)
abline(h = 0, col = "red")
Influence Diagnostics
library(influence.ME)
# Study-level influence
infl <- influence(fit, group = "study")
# Cook's distance by study
cooks.distance(infl)
# DFBETAs
dfbetas(infl)
# Plot influence
plot(infl, which = "cook")
Reporting IPD-MA Results
# Create comprehensive summary table
create_ipd_ma_summary <- function(fit_one_stage, fit_two_stage) {
summary_table <- tibble(
Method = c("One-stage (mixed effects)", "Two-stage (meta-analysis)"),
Estimate = c(
fixef(fit_one_stage)["treatment"],
fit_two_stage$beta
),
SE = c(
sqrt(vcov(fit_one_stage)["treatment", "treatment"]),
fit_two_stage$se
),
CI_Lower = Estimate - 1.96 * SE,
CI_Upper = Estimate + 1.96 * SE,
Heterogeneity = c(
VarCorr(fit_one_stage)$study["treatment", "treatment"],
fit_two_stage$tau2
)
)
return(summary_table)
}
Key Packages Summary
| Package | Purpose | |---------|---------| | lme4 | Linear/generalized mixed-effects models | | metafor | Two-stage meta-analysis | | coxme | Mixed-effects Cox models | | survival | Stratified/frailty survival models | | mice | Multiple imputation | | mitml | MI pooling for multilevel | | multinma | IPD network meta-analysis | | ipdmeta | IPD-MA utilities | | joineR | Joint models for IPD | | DHARMa | Residual diagnostics |
Best Practices
- Data sharing: Establish data governance before IPD collection
- Harmonization: Standardize variable definitions across studies
- One vs two-stage: One-stage preferred for treatment-covariate interactions
- Random effects: Include random treatment effects to allow for heterogeneity
- Missing data: Use multilevel MI methods; conduct sensitivity analyses
- Confounding: Separate within vs between-study covariate effects
- Reporting: Follow PRISMA-IPD guidelines
- Sensitivity: Compare one-stage and two-stage results
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: choxos
- Source: choxos/BiostatAgent
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.