← ClaudeAtlas

ipd-meta-analysislisted

Individual participant data meta-analysis in R, including one-stage, two-stage, survival, and IPD with aggregate data.
choxos/BiostatAgent · ★ 4 · Data & Documents · score 75
Install: claude install-skill choxos/BiostatAgent
# 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 ```r library(dplyr) library(purrr) library(broom) # IPD from multiple studies ipd_data <- data.frame( study = rep(paste0("Study", 1:5), each = 100), patient_id = 1:500, treatment = rbinom(500, 1, 0.5), age = rnorm(500, 60, 10), outcome = rnorm(500, 50, 15) ) # Stage 1: Analyze each study separately study_results <- 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 ```r library(metafor) # Stage 2: Meta-analyze study-level estimates ma_result <- rma( yi = study_results$estimate, sei = study_results$std.error, method = "REML", slab = study_results$study ) summary(ma_result) # Forest plot forest(ma_result, header = TRUE) # Heterogeneity cat("I-squared:", round(ma_result$I2, 1), "%\n") cat("Tau-squared:", round(ma_result$tau2, 4),