Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Survival Analysis with Inverse Probability Weighting after Multiple Imputation

    I am performing survival analysis with inverse probability treatment weighting after multiple imputation as I am missing 5% data in 3 covariates in my final substantive model.

    My dataset has 175,870 observations.

    I have two queries for those who have more experience in these methods:
    • Following multiple imputation, I created inverse probability weighted (ipw) propensity score .
    When I create this score, I noticed that in each imputed dataset (m=10) there were 22,661 missing ipw scores. I am not sure why this is given this was performed on the mi datasets which do not have any missing values anymore.
    But, in the m=0 dataset, there are no missing ipw scores.
    Am I meant to be using only the ipw scores stored in M=0?
    • After mi stcox, it appears that there are only 149,019 observations. Is this because I am missing ipw propensity scores?
    Thank you very much for your time.

    Below is my code and dataex.

    Best Wishes,
    Jennifer

    ​​​​​​​
    Code:
     *Multiple Imputation of missing covariates*
    
    mi set mlong
     
    mi misstable patterns edu_cat bmi_cat mbr_gdm p_inpatient year_cat age_cat smoke bw_grams  if pop==1
    
    mi register imputed edu_cat weight_kg length_cm smoke bw_grams
    
    mi register regular pe egfr59 timetoprimary protein timetopro cht timetocht ckd ///
        timetockd kt timetokt dial timetokrt ///
        b_age b_year death d_date origin pin parity excl sga inter_year inter_multi
    
    mi impute chained (mlogit) edu_cat (logit) smoke (regress) weight_kg length_cm bw_grams, replace add(10) rseed(23456) noisily
    
    mi passive: generate bmi=weight_kg/(length_cm/100)^2
    
    mi passive: gen bmi_cat=.
    mi passive: replace bmi_cat=1 if bmi<18.5
    mi passive: replace bmi_cat=2 if bmi>=18.5 & bmi<25
    mi passive: replace bmi_cat=3 if bmi>=25 & bmi<30
    mi passive: replace bmi_cat=4 if bmi>=30 & bmi<.
    
    mi passive: gen lbw=1 if bw_grams<2500
    mi passive: replace lbw=0 if bw_grams>=200 &bw_grams!=.
    mi passive: gen inter_lbw=pe*lbw
    
    *Primary outcome -IPW survival analysis*
    
    //generate propensity score//
    mi estimate, saving(psprimary, replace): logit pe i.edu_cat i.bmi_cat mbr_gdm p_inpatient i.year_cat i.age_cat smoke
    mi predict xb_pe using psprimary
    mi xeq: generate ps_pe=invlogit(xb_pe)
    
    //generate numerator for subsequent iptw stabilisation//
    mi estimate, saving(psprimary_n, replace): logit pe
    mi predict xb_num using psprimary_n
    mi xeq: generate num_pe=invlogit(xb_num)
    
    //generate stabilised iptw//
    mi xeq: gen siptw=num_pe/ps_pe if pe==1
    mi xeq: replace siptw=(1-num_pe)/(1-ps_pe) if pe==0
    
        
    //declare survival time data//
    mi stset timetoprimary if pop==1 [pweight=siptw], failure(egfr59==1) scale(30.44)
    
    //weighted cox proportional hazards model//
    mi estimate, eform: stcox pe, vce(robust)
    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str5 __code9 str25 __desc9
    "1469" "malig neo oropharynx nos" 
    "4375" "moyamoya disease"         
    "4464" "wegener's granulomatosis" 
    "6751" "breast abscess in preg*"  
    "7569" "musculoskel anom nec/nos" 
    "8091" "fracture trunk bone-open" 
    "8396" "dislocat oth site-closed*"
    "E845" "spacecraft accident*"     
    "E924" "hot substance accident*"  
    "V292" "obsrv nb suspc resp cond" 
    end
Working...
X