Hi,
I am modelling hospital mortality data (dichotomous rsponse variable) using GLIMMIX at three levels: patient, doctor, hospital. I have over 3million patients, about 80,000 doctors and about 70 hospitals. My code looks like:
proc glimmix data=mortality method=quad;
class doctor hospital;
model death(event=1)= patient_covariates hospital_covariates doctor_covariates doctor hospital/dist=b s;
random intercept/ subject=hospital;
random intecept /subject=doctor(hospital);
run;
I can not make this model to converge. I wonder whether I have too many levels on the 'doctor' variable which has so many lavels?
Any help would be appreciated!
That is a possibility. One thing you might try is giving each doctor a unique NUMERICAL id, and then removing doctor from the class statement. I would also remove the fixed effects of doctor and hospital from the MODEL statement. Also, change from dist=b, which is a binomial and more suited to aggregated data, to dist=binary, to reflect the 0/1 nature of your data. Consider changing from method=quad to method=laplace. And finally, when you say that the model does not converge, I suspect that you are hitting the 20 iteration default and getting a message, rather than letting the procedure iterate as much as needed. Try adding and NLOPTIONS statement:
nloptions maxiter=1000;
Steve Denham
Steve,
Thank you for all those suggestions. I will try them and get back here.
Best wishes.
Steve,
I made all the suggested changes (except making my DOCTOR_ID
Numerical). I am happy to report that the code has
converged (GCONV=1E-8) as displayed in my Log window, HOWEVER,
it is taking a very long time to finish. I set the code running yesterday at
4pm(GMT) and it is still running… 18hrs and counting. I am very tempted
to let it run over the weekend, but wonder whether it is really working or has
it got stuck somewhere? No error messages though.
Regards
There is a good chance that the likelihood is in a very flat space and is essentially just thrashing around a fixed point. You might try adding:
pconv=1e-6
to the proc glimmix call. If all parameters are relatively stable (which is what this checks) you should be good.
Steve Denham
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.