***************************************************************************************** * Linear Mixed Models with Multiple Imputation for Repeated Measures Trials\cb1. * ***************************************************************************************** *** STEP 1: Prepare data in "long-format" *** STEP 2: Set data structure for multiple imputation mi set mlong *** STEP 3: Reshape data from long to wide format * Assumes outcome is the repeated measure (e.g., VAS, ODI, ROM) mi reshape wide outcome, i(id) j(time) *** STEP 4: Register variables for imputation * All relevant variables (with or without missing)should be registered mi register imputed /// outcome0 outcome1 outcome2 /// repeated outcomes Group arm gender /// grouping variables Height Weight BMI /// anthropometric variables Sex Dominant Smoking /// demographic/lifestyle Occupation Education Duration3 /// socioeconomic/clinical *** STEP 5: Impute missing values using chained equations mi impute chained /// (logit) Group Sex Smoking Dominant /// (ologit) Occupation Education /// (regress) outcome1 outcome2 Height Weight BMI Duration /// = outcome0, add(10) rseed(1234) *** STEP 6: Reshape data back to long format before executing mixed model mi reshape long outcome, i(id) j(time) *** STEP 7: Fit Linear Mixed Model with Random Effects mi estimate: xtreg outcome i.arm##i.time i.gender, i(id) re * Note: Post-estimation commands are not supported after `mi estimate` * Thus, analysis continues with manually separated datasets *** STEP 8: Exit MI environment and save each combined dataset mi unset * Repeat for each imputed dataset (m = 1 to 10) * Example for m=1: keep if mi_m == 0 | mi_m == 1 drop if mi_miss == 1 save dataset_0_1, replace *** STEP 9: In each dataset, run LMM and post-estimations xtset id time xtreg outcome i.arm##i.time i.gender, re * Estimate marginal means and contrasts (main outcomes) contrast arm@time, effects * Adjust for multiple comparisons using Bonferroni contrast arm@time, effects mcomp(bon) *** STEP 10: Pool marginal differences (MD) and standard errors (SE) * Use Rubin's Rules (1987) via Excel or meta-analysis script * Input 10 MDs and 10 SEs to compute pooled effect size ************************************************************************** * END of Analysis Protocol * **************************************************************************