I am doing recurrent event analysis (Anderson-Gill Model). I have around 15 co-variates each with <1% of missing data needing imputation.
When I try to calculate IPW, I am noticing difficulties in the form of weight not same within each id.
When I sort data, and make sure that each id has same IPW, I am getting error message with stset (3245: improper weight: PROBABLE ERROR).
Code:
##MI setting mi set mlong mi stset, clear ## Registering missing variables mi register imputed prev_cancer age_r sex ethnic_r smoker2 q6 q9_r q10_r q11 q12 q13 q15 q16 q45 q46 ## Imputing missing data mi impute chained (ologit) ethnic_r (ologit, ascontinuous) smoker2 (ologit, ascontinuous) q6 (ologit, ascontinuous) q9_r (ologit, ascontinuous) q10_r (ologit, ascontinuous) q11 (ologit, ascontinuous)q12 (ologit, ascontinuous) q13 (ologit, ascontinuous) q15 (ologit, ascontinuous) q16 (ologit, ascontinuous) q45(ologit, ascontinuous) q46 (ologit, ascontinuous) prev_cancer age_r sex, add(5) augment ## Estimating logit mi estimate, eform saving(m1) : logit event age_r sex ethnic_r smoker2 q6 q9_r q10_r q11 q12 q13 q15 q16 q45 q46 ## Predicting linear predictor mi predict pi using m1.ster quietly mi xeq: gen phat2= invlogit(pi) quietly mi xeq: gen ipw2= . quietly mi xeq: replace ipw2= 1/phat2 if u1==1 quietly mi xeq: replace ipw2= 1/(1-phat2) if u1==0 ## Setting survival settings mi stset t1[pweight = ipw2] if prev_cancer==0, failure(event) exit(time .) enter(time t0)origin(time consent_date_ct)id(uid)
With warm regards,
Sateesh
0 Response to Calculating Inverse probability weights after multiple imputation with recurrent events
Post a Comment