************************************************************************************************** * LABORATORIO ************************************************************************************************** * Scopo: chi è nato all'estero (dn004) ha più probabilità di sviluppare sintomi depressivi (Eurodcat)? * Utilizziamo le variabili: keep wave interview mergeid fam_resp wspeed age_int gender iv008 bmi eurodcat country dn041_ dn004_ * 1- Distinguere i missing per costruzione * 2- Eliminiamo quei missing nelle variabili ausiliarie (iv008). E imputiamo alla moda o media * le variabili che consideriamo complete (mergeid fam_resp age_int gender country dn004_) *31682 casi no interview -> unit non-response drop if interview!=1 tab iv008,mi drop if iv008<0 | iv008==. misstable sum tab dn004 wave,mi nol sort mergeid wave replace dn004=dn004[_n-1] if mergeid==mergeid[_n-1] & dn004==. recode dn004(-1 -2 . =1) (5=2) tab dn041 wave,mi sort mergeid wave replace dn041=dn041[_n+1] if mergeid==mergeid[_n+1] & dn041==. recode dn041(min/-1=.) recode bmi(min/-1=.) tab wave if wspeed!=. * 3- Verificare le assunzioni alla base dei modelli di imputazione: * meccanismo & pattern * 3.1 Pattern monotono o arbitrario misstable pattern * 3.2 Meccanismi generativi: CMAR o MAR drop miss gen miss=1 if wspeed==. | eurodcat==. | bmi==. | dn041_==. recode miss(.=0) logit miss gender wave i.iv008 * 4- Prima di imputare (1) bmi (2) eurodcat (3) dn041_ (4) wspeed * guardare come sono distribuite hist bmi hist dn041, dis hist wspeed tab eurodcat,mi * 5- Modello di imputazione appropriato, facciamo 10 imputazioni mi set mlong mi register imputed wspeed bmi dn041 eurodcat mi register regular country age_int gender dn004 wave mi register passive iv008 fam_resp mi impute chained (truncreg,ll(12.49) ul(80.33)) bmi (logit) eurodcat /// (truncreg,ll(0) ul(25)) dn041_ (pmm, knn(5)) wspeed = //// country age_int gender dn004 wave iv008 fam_resp, add(10) rseed(53421) tabstat bmi,st(min max ) tabstat dn041,st(min max ) ************************************************************************ Multivariate imputation Imputations = 10 Chained equations added = 10 Imputed: m=1 through m=10 updated = 0 Initialization: monotone Iterations = 100 burn-in = 10 bmi: truncated regression eurodcat: logistic regression dn041_: truncated regression wspeed: predictive mean matching ------------------------------------------------------------------ | Observations per m |---------------------------------------------- Variable | Complete Incomplete Imputed | Total -------------------+-----------------------------------+---------- bmi | 64989 1694 1694 | 66683 eurodcat | 65308 1375 1375 | 66683 dn041_ | 56247 10436 10436 | 66683 wspeed | 7156 59527 59527 | 66683 ------------------------------------------------------------------ * 6- Diagnostica midiagplots wspeed, m(1/4) combine midiagplots bmi, m(1/4) combine midiagplots dn041, m(1/4) combine midiagplots eurodcat * 7- Modello analitico approppriato per predire Eurodcat mi estimate, dots: logit eurodcat wspeed bmi dn041 /// i.country age_int gender i.dn004 wave * 8- Interpretare i risultati in termini di probabilità predette * rispetto alla var di interessa (dn004) mimrgns dn004, predict(pr) * 7- Modello analitico approppriato per predire Eurodcat * 8- Interpretare i risultati in termini di probabilità predette * rispetto alla var di interessa (dn004) * 9- Se utilizzassimo un modello di imputazione MVN * come cambierebbero i risultati del modello analitico? * sempre rispetto alla variabile di interesse *10- Rispetto al modello sui dati completi?