BookmarkSubscribeRSS Feed
medea
Calcite | Level 5

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!

4 REPLIES 4
SteveDenham
Jade | Level 19

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


medea
Calcite | Level 5

Steve,

Thank you for all those suggestions. I will try them and get back here.

Best wishes.

medea
Calcite | Level 5

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

SteveDenham
Jade | Level 19

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1434 views
  • 4 likes
  • 2 in conversation