Implements pre-specified missing-data analyses for confirmatory clinical trials following NRC 2010 and ICH E9(R1). Covers MMRM under MAR with Kenward-Roger correction, reference-based multiple imputation (J2R, CR, CIR, LMCF per Carpenter-Roger 2013), Permutt delta-adjustment / tipping-point analysis, pattern-mixture identifying restrictions, and the Cro vs Bartlett information-anchored vs frequentist variance debate.
pip install scikit-learn statsmodels pandas numpy
R is strongly recommended for confirmatory work (the Python alternatives lack Kenward-Roger):
install.packages(c('mmrm', 'rbmi', 'mice', 'mitools'))
Tell your AI agent what you want to do: - "Fit an MMRM under MAR for continuous longitudinal endpoint with Kenward-Roger correction" - "Run J2R reference-based multiple imputation as MNAR sensitivity for my treatment-policy estimand" - "Compute the Permutt tipping-point delta that flips the primary p-value above 0.05" - "Report both Cro information-anchored variance AND Wolbers frequentist variance for J2R analysis" - "Convert my CDISC trial dataset to long format and apply MMRM with the SAS PROC MIXED-equivalent options"
"Fit an MMRM in R
mmrmfor change-from-baseline outcome with treatment, visit, treatment-by-visit, baseline, baseline-by-visit. Use unstructured covariance with Kenward-Roger-Linear DF. Report the contrast at the primary timepoint.""MMRM with UN+KR failed to converge. Fall back to heterogeneous Toeplitz with KR, per pre-specified SAP hierarchy."
"My estimand is treatment policy. ICE = treatment discontinuation due to AE in active arm. Run J2R imputation in rbmi with Bayesian MI + Rubin's rules as primary, CMI+jackknife frequentist as supportive."
"Apply CIR (copy-increments-in-reference) imputation rather than J2R because we want to credit the on-treatment increment but assume post-ICE trend matches placebo."
"Run a tipping-point analysis. Apply delta only to active-arm imputed values, scan delta from 0 to 20 in units of the residual SD. Report the tipping delta that flips primary p above 0.05."
"Tipping delta = 8 mmHg. Compare to MCID of 5 mmHg for SBP -- judge clinical plausibility."
"Report both Rubin's rules variance (Cro 2019 information-anchored) and CMI+jackknife frequentist variance (Wolbers 2022) for the J2R primary sensitivity analysis. Justify the discrepancy in the report."
"My trial has differential dropout -- 35% in active arm vs 12% in placebo, with active-arm dropouts predominantly due to AEs. MAR is implausible. Switch to treatment-policy estimand with retrieved-dropout MI as primary, J2R as sensitivity."
mmrm package in R; statsmodels.mixedlm lacks KR and is not FDA-equivalent.sample_posterior=True only works with BayesianRidge; silently ignored otherwise. For confirmatory work, use R rbmi or mice.