BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
NMB82
Obsidian | Level 7

I'm trying to fit a 3-level model with hospital admissions (n=32,052) nested within patients (n=19,811) nested within hospital site (n=9). I'm using several categorical and binary variables as fixed effects to predict a binary outcome. I want to know if certain encounter characteristics (insurance, admission source) and patient characteristics (age, sex, race, language, alcohol/drug use, housing status) predict physical restraint use and whether this varies by site. 

 

proc glimmix data=data ITDETAILS ;
CLASS 
    AgeGrp Race Gender Ethnicity Language Insurance Site Alcohol Drug 
    MHealth Homeless PatID AdmitSource 
 ;
model Restraint (descending)= 
    AgeGrp Gender Race Ethnicity Language Insurance Alcohol Drug MHealth
    Homeless AdmitSource
    / CL DIST=BINARY LINK=LOGIT SOLUTION ODDSRATIO DDFM=BW;
random intercept / subject=PatID(Site);
random intercept / subject=Site;
COVTEST / WALD;
run;

1. The above code gives an insufficient memory error. I'm using SAS EG with default settings and don't have access to the config file to increase MEMSIZE, but I'm in touch with IT and hope they can adjust it. Is this typical? It doesn't seem like an overly complicated model.

 

2. Encounters are uniquely clustered in patients, but patients can have different site visits. Would this have an impact? Do I need to adjust for this?

 

3. When I run the 2-level model (with the below random line as the only random line) with encounters clustered within patients, it runs fine and the results/fit look good, but I have a nitpicky reviewer asking about Site random effect and want to figure this out. 

random intercept / subject=PatientID;
1 ACCEPTED SOLUTION

Accepted Solutions
STAT_Kathleen
SAS Employee

I would try using METHOD=QUAD(FASTQUAD) to estimate the model.  For more information on FASTQUAD option refer to the following SAS Note:

 

http://support.sas.com/kb/60666

 

I would also suggest listing your RANDOM statements from least complex to most complex.  For example:

 

random intercept / subject=Site;

random intercept / subject=PatID(Site);

 

If you want to provide a data set I can see if there are other recommendations.

 

Thanks,

Kathleen

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26

Memory issues are not due to the complexity of the model but rather due to the number of distinct levels of patients (and number of levels of all of your class variables).

--
Paige Miller
NMB82
Obsidian | Level 7

Ok, good to know. The predictors all have <=5 categories, however there are ~20,000 distinct patients, which I assume is the culprit here? Having said that, the code with only encounters nested within patients does run ok.

random intercept / subject=PatID;

It's only when you add the 2nd Random line with Site, that it gives the memory error. But, Site only has 9 levels. 

 

Is my only recourse to increase MEMSIZE?

 

 

STAT_Kathleen
SAS Employee

I would try using METHOD=QUAD(FASTQUAD) to estimate the model.  For more information on FASTQUAD option refer to the following SAS Note:

 

http://support.sas.com/kb/60666

 

I would also suggest listing your RANDOM statements from least complex to most complex.  For example:

 

random intercept / subject=Site;

random intercept / subject=PatID(Site);

 

If you want to provide a data set I can see if there are other recommendations.

 

Thanks,

Kathleen

NMB82
Obsidian | Level 7

Hi Kathleen, thanks for the response. I have tried using method=quad(fastquad), but it still gives the memory error. As explained here (https://support.sas.com/resources/papers/proceedings12/332-2012.pdf ), I altered the code to look like the below and it does run, but I'm not able to use the method=quad option with the "_residual_" added and thus, can't get the AIC fit statistics. 

 

random intercept / subject=SiteCD solution;
random _residual_ / subject=PatID(SiteCD) solution;

SteveDenham
Jade | Level 19

Stroup and Claassen recently published a paper comparing pseudolikelihood methods to quadrature methods.  In particular, they spend a lot of time on binomial response models.  Their findings indicate that for most cases, pseudolikelihood (linearization) performs at least as well, if not better, than quadrature.  Here is the reference:  Journal of Agricultural, Biological and Environmental Statistics volume 25, pages 639–656.  This is freely available if you have an ASA membership, but is otherwise behind a paywall.

 

SteveDenham

Ksharp
Super User
If you could switch into PROC GEE ,instead of Mixed model .

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1015 views
  • 6 likes
  • 5 in conversation