Hi,
I am analyzing a large dataset on surgeries. We want to explore the risk of having a surgical complication depending on if the surgery was performed during day or night time. Model will be adjusted for sex, age, comorbidity (grpci) and case urgency.
We have missing data on ASA-score (physical status scoring) and are thus using multiple imputation, using all variables in the regression for estimation.
We believe that the coefficients vary by hospital as well as by patients. We therefore wish to use a mixed effects model, after the imputation of ASA. One specific patient might perform surgery at different hospitals, so we do not want to have patients nested within hospital.
So I guess what we want is a crossed random effects. Am I right? If I am, I would like to include a random effect for “Id” and another random effect for “Hospital”. However the code takes days to run on my new Macbook Pro.
Our code is as follows:
Code:
** Imputation part (only missingness on ASA mi set mlong mi register imputed ASA mi impute mlogit ASA Complication NightTime Sex Age grpci CaseUrgency Hospital, add(20) noisily augment ** Estimation part mi estimate, or: meqrlogit Complication i.NightTime i.ASA i.Sex Age i.grpci i.CaseUrgency || Hospital: || Id:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long Id int Age byte(Sex Hospital grpci Complication ASA NightTime) float CaseUrgency 1 88 0 58 2 0 1 1 0 3 40 1 58 0 0 0 0 0 4 58 0 36 0 0 0 0 0 13 42 1 58 0 0 0 0 0 13 42 1 58 0 0 1 0 0 13 42 1 58 0 0 1 0 0 17 20 0 55 0 0 0 1 0 21 56 0 79 1 0 1 1 0 21 57 0 79 2 0 1 1 0 22 65 1 30 2 0 1 1 0 22 65 1 30 2 0 1 1 1 25 77 1 25 2 0 0 0 0 25 77 1 25 2 0 0 1 0 26 55 0 36 2 0 1 0 0 27 91 0 30 2 0 2 0 1 30 77 1 29 2 0 1 0 0 32 62 0 57 1 0 . 1 1 35 57 0 70 0 0 0 0 0 41 54 1 30 0 0 2 0 1 45 31 0 29 0 0 2 1 1 46 50 1 1 1 0 0 0 1 57 37 0 56 0 0 . 0 1 62 45 0 29 0 0 0 1 0 64 40 0 43 0 0 0 1 0 71 71 1 58 2 0 . 1 0 71 71 1 58 2 0 1 1 0 72 34 0 79 0 0 1 0 0 73 21 0 1 0 0 0 1 0 74 33 0 29 0 0 0 0 0 74 33 0 14 0 0 0 1 0 77 43 0 1 0 0 0 0 0 77 43 0 1 0 0 0 0 0 77 43 0 1 2 0 0 0 0 85 32 0 14 0 0 0 1 0 86 39 0 14 0 0 0 1 1 90 74 0 9 0 0 1 1 0 92 43 0 58 0 0 0 0 0 93 29 0 17 0 0 0 1 0 98 44 1 1 0 0 . 0 0 100 29 0 58 0 0 0 1 0 103 70 1 41 2 0 0 1 0 106 78 1 14 2 0 2 1 0 108 31 1 14 0 0 0 1 0 109 57 0 58 1 0 0 1 0 110 75 1 9 2 0 2 0 0 110 75 1 9 2 0 1 1 0 112 19 0 1 0 0 0 1 0 116 90 0 9 2 0 1 0 0 123 76 1 9 0 0 0 1 0 124 64 0 14 0 0 0 0 0 125 71 0 14 1 0 0 0 0 127 53 0 56 0 0 0 1 0 132 25 1 7 0 0 0 1 0 135 55 0 62 0 0 0 0 0 136 81 1 58 0 0 0 0 0 144 83 1 12 1 0 1 1 0 146 48 0 53 0 0 0 0 0 149 45 0 11 0 0 0 0 0 158 53 1 39 0 0 0 0 0 161 24 1 34 0 0 0 1 0 169 34 0 65 0 0 0 0 0 174 20 1 34 0 0 0 1 0 174 20 1 34 0 0 0 1 0 179 39 0 9 0 0 0 1 0 185 34 1 55 0 0 0 0 1 188 73 1 57 0 0 0 1 0 188 73 1 57 0 0 0 1 0 188 74 1 80 0 0 0 1 0 189 29 0 61 0 0 0 1 0 189 29 0 61 0 0 0 0 0 189 31 0 61 0 0 0 0 0 190 26 0 72 0 0 0 1 0 196 49 0 14 0 0 0 1 0 197 70 0 14 0 0 0 1 0 198 27 1 56 0 0 0 0 0 206 49 0 44 0 0 0 0 0 208 72 0 30 2 0 1 1 1 209 44 1 56 0 0 0 1 0 210 36 1 32 1 0 0 1 0 210 37 1 72 1 0 0 0 0 210 38 1 58 1 0 1 0 0 211 74 1 58 2 0 1 0 0 213 74 0 9 1 0 0 1 0 228 88 0 9 0 0 2 1 0 229 23 1 65 0 0 0 0 0 230 49 1 29 0 0 0 0 0 232 63 0 57 1 0 . 1 1 239 52 0 57 0 0 0 1 0 247 28 1 45 0 0 0 0 0 250 76 1 14 2 0 1 0 0 250 76 1 14 2 0 1 1 0 255 80 0 58 0 0 2 0 1 261 64 0 1 0 0 0 1 1 261 64 0 1 0 0 2 1 0 267 94 0 14 2 0 1 1 0 268 56 1 29 0 0 0 1 0 270 70 0 30 0 0 1 1 0 275 62 1 56 0 0 0 0 0 277 74 0 58 2 0 1 0 0 278 32 0 14 0 0 0 0 1 end label values Sex KON label def KON 0 "0. Female", modify label def KON 1 "1. Male", modify label values grpci grpci label def grpci 0 "0. Charlson Index Score 0", modify label def grpci 1 "1. Charlson Index Score 1", modify label def grpci 2 "2. Charlson Index Score >1", modify label values ASA ASA_4cat label def ASA_4cat 0 "ASA Score 1-2", modify label def ASA_4cat 1 "ASA Score 3", modify label def ASA_4cat 2 "ASA Score 4", modify
Comment