Multiple imputation for systematically missing effect modifiers in individual participant data meta-analysis

------------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  applied_example_cqi
       log:  /Users/robert/Desktop/manuscript_applied_example/applied_example_cqi.smcl
  log type:  smcl
 opened on:  16 May 2024, 09:34:11


. . // Install CQI . net describe "http://www.stats4life.se/stata/mi_impute_cqi"

------------------------------------------------------------------------------------------------------------------------------------------------------------ package mi_impute_cqi from http://www.stats4life.se/stata ------------------------------------------------------------------------------------------------------------------------------------------------------------

TITLE 'mi impute cqi': Conditional Quantile imputation

DESCRIPTION/AUTHOR(S) Requires: Stata version 18 Distribution-Date: 2023-12-2 Authors: Nicola Orsini and Robert Thiesmeier, Karolinska Institutet Support: nicola.orsini@ki.se

INSTALLATION FILES (type net install mi_impute_cqi) m/mi_impute_cqi.sthlp m/mi_impute_cmd_cqi_parse.ado m/mi_impute_cmd_cqi_init.ado m/mi_impute_cmd_cqi.ado m/mi_impute_cmd_cqi_return.ado ------------------------------------------------------------------------------------------------------------------------------------------------------------

. net install mi_impute_cqi checking mi_impute_cqi consistency and verifying not already installed... all files already exist and are up to date.

. . // Check for mvmeta . quietly cap which mvmeta

. if _rc != 0 qui scc install mvmeta

. . // Load IPD data for postoperative radiotherapy on survival at different stages of the disease . use "http://fmwww.bc.edu/repec/bocode/i/ipdmetan_example.dta", clear

. . // recode variables to be consistent with description in the manuscript . recode stage (1=0) (2=1) (3=2), gen(z) (1,187 differences between stage and z)

. rename trt x

. rename tcens time

. rename fail outcome

. gen zi1 = (z==1)

. gen zi2 = (z==2)

. gen x_zi1 = x*zi1

. gen x_zi2 = x*zi2

. . // Analsysis with only complete studies . preserve

. keep if inlist(trialid, 1, 3, 10)!= 1 (455 observations deleted)

. stset time, fail(outcome)

Survival-time data settings

Failure event: outcome!=0 & outcome<. Observed time interval: (0, time] Exit on or before: failure

-------------------------------------------------------------------------- 1,187 total observations 0 exclusions -------------------------------------------------------------------------- 1,187 observations remaining, representing 785 failures in single-record/single-failure data 766.434 total analysis time at risk and under observation At risk from t = 0 Earliest observed entry t = 0 Last observed exit t = 5.811862

. . quietly mvmeta_make, by(trialid) clear names(b V): stcox x zi1 zi2 x_zi1 x_zi2

. mvmeta b V, fixed Note: using method fixed Note: using variables bx bzi1 bzi2 bx_zi1 bx_zi2 Note: 7 observations on 5 variables

Multivariate meta-analysis Variance-covariance matrix = (none) Method = fixed Number of dimensions = 5 Number of observations = 7 ------------------------------------------------------------------------------ | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- Overall_mean | bx | -.0046955 .125941 -0.04 0.970 -.2515353 .2421442 bzi1 | .1584711 .1226066 1.29 0.196 -.0818334 .3987757 bzi2 | -.1103261 .1319873 -0.84 0.403 -.3690164 .1483642 bx_zi1 | .0224724 .1741227 0.13 0.897 -.3188018 .3637466 bx_zi2 | .3639466 .181914 2.00 0.045 .0074017 .7204914 ------------------------------------------------------------------------------

. . testparm bx_zi1 bx_zi2

( 1) [Overall_mean]bx_zi1 = 0 ( 2) [Overall_mean]bx_zi2 = 0

chi2( 2) = 5.00 Prob > chi2 = 0.0823

. . * display results that are used for Table 3 . lincom bx , eform cformat(%3.2f)

( 1) [Overall_mean]bx = 0

------------------------------------------------------------------------------ | exp(b) Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- (1) | 1.00 0.13 -0.04 0.970 0.78 1.27 ------------------------------------------------------------------------------

. lincom bx + bx_zi1 , eform cformat(%3.2f)

( 1) [Overall_mean]bx + [Overall_mean]bx_zi1 = 0

------------------------------------------------------------------------------ | exp(b) Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- (1) | 1.02 0.12 0.15 0.883 0.80 1.29 ------------------------------------------------------------------------------

. lincom bx + bx_zi2 , eform cformat(%3.2f)

( 1) [Overall_mean]bx + [Overall_mean]bx_zi2 = 0

------------------------------------------------------------------------------ | exp(b) Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- (1) | 1.43 0.19 2.73 0.006 1.11 1.85 ------------------------------------------------------------------------------

. restore

. . * Including studies with systematic missing studies . mi set wide

. mi stset time, fail(outcome)

Survival-time data settings

Failure event: outcome!=0 & outcome<. Observed time interval: (0, time] Exit on or before: failure

-------------------------------------------------------------------------- 1,642 total observations 0 exclusions -------------------------------------------------------------------------- 1,642 observations remaining, representing 1,082 failures in single-record/single-failure data 1,025.389 total analysis time at risk and under observation At risk from t = 0 Earliest observed entry t = 0 Last observed exit t = 5.811862

. sts generate ch = na

. gen x_ch = x*ch

. gen x_d = x*_d

. mi register regular x ch _d x_ch x_d (variable _d already registered as regular)

. mi register imputed z

. mi register passive zi1 zi2 x_zi1 x_zi2

. . * using CQI . mi impute cqi z x _t _d x_ch x_d sex age, add(30) id(trialid) rseed(150524) ------------------------------------------------------------------ id Total Incomplete Missing (%) ------------------------------------------------------------------ 1 176 176 100.0 2 141 0 0.0 3 110 110 100.0 4 69 0 0.0 5 160 0 0.0 6 115 0 0.0 7 238 0 0.0 8 148 0 0.0 9 316 0 0.0 10 169 169 100.0 ------------------------------------------------------------------

Conditional Quantile Imputation Imputations = 30 User method cqi added = 30 Imputed: m=1 through m=30 updated = 0

------------------------------------------------------------------ | Observations per m |---------------------------------------------- Variable | Complete Incomplete Imputed | Total -------------------+-----------------------------------+---------- z | 1187 455 455 | 1642 ------------------------------------------------------------------ (Complete + Incomplete = Total; Imputed is the minimum across m of the number of filled-in observations.)

. quietly mi passive: replace zi1 = (z==1)

. quietly mi passive: replace zi2 = (z==2)

. quietly mi passive: replace x_zi1 = x*zi1

. quietly mi passive: replace x_zi2 = x*zi2

. . quietly mvmeta_make, by(trialid) clear names(b V): mi estimate, post: stcox x zi1 zi2 x_zi1 x_zi2

. mvmeta b V, fixed Note: using method fixed Note: using variables bx bzi1 bzi2 bx_zi1 bx_zi2 Note: 10 observations on 5 variables

Multivariate meta-analysis Variance-covariance matrix = (none) Method = fixed Number of dimensions = 5 Number of observations = 10 ------------------------------------------------------------------------------ | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- Overall_mean | bx | .0284935 .1132223 0.25 0.801 -.1934183 .2504052 bzi1 | .1674768 .1118511 1.50 0.134 -.0517473 .386701 bzi2 | -.1053183 .1208164 -0.87 0.383 -.3421141 .1314775 bx_zi1 | .0053963 .1602372 0.03 0.973 -.3086629 .3194555 bx_zi2 | .3440081 .1667291 2.06 0.039 .0172251 .6707912 ------------------------------------------------------------------------------

. . * display results that are used for Table 3 . testparm bx_zi1 bx_zi2

( 1) [Overall_mean]bx_zi1 = 0 ( 2) [Overall_mean]bx_zi2 = 0

chi2( 2) = 5.53 Prob > chi2 = 0.0630

. lincom bx , eform cformat(%3.2f)

( 1) [Overall_mean]bx = 0

------------------------------------------------------------------------------ | exp(b) Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- (1) | 1.03 0.12 0.25 0.801 0.82 1.28 ------------------------------------------------------------------------------

. lincom bx + bx_zi1 , eform cformat(%3.2f)

( 1) [Overall_mean]bx + [Overall_mean]bx_zi1 = 0

------------------------------------------------------------------------------ | exp(b) Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- (1) | 1.03 0.11 0.31 0.757 0.83 1.28 ------------------------------------------------------------------------------

. lincom bx + bx_zi2 , eform cformat(%3.2f)

( 1) [Overall_mean]bx + [Overall_mean]bx_zi2 = 0

------------------------------------------------------------------------------ | exp(b) Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- (1) | 1.45 0.17 3.14 0.002 1.15 1.83 ------------------------------------------------------------------------------

. log close applied_example_cqi name: applied_example_cqi log: /Users/robert/Desktop/manuscript_applied_example/applied_example_cqi.smcl log type: smcl closed on: 16 May 2024, 09:34:21 ------------------------------------------------------------------------------------------------------------------------------------------------------------