BookmarkSubscribeRSS Feed
Solph
Pyrite | Level 9

Hi,

 

I've a GLIMMIX question in terms of how to specify the random effect. Specifically I've three-level data, with students nested in school, then schools nested in regions. And I've three level-1 variables and two level-2 variables - and level 2 variables are especially of interest. A random intercept model for level 2 and level 3 would do. Random intercept and random slope model is ideal. My outcome variable is not linear, so I used Gamma distribution with link=log.

 

What confused me is how I should let SAS know which variable are level 2 variables? What variables are for identifying different levels (StudentID, SchoolID, GeoID) in the random statement. How do I use the random statement to indicate levels? Where do I put the level 2 variables - if I assume 1) fix slope, or 2) random stlop. 

 

I was told I have to have 3 RANDOM statement: /GeoID, then subject=SchoolID(GeoID), then subject=StudentID(SchoolID, GeoID), as below (but the model wouldn't run as it won't converge or ran out of memory), corrrect?

 

proc glimmix data=mydata  METHOD=LAPLACE NOCLPRINT;
    class PatientID HospID GeoID L1_var1 L1_var2 L1_var3 /*level 1 categorical vars*/ L2_var1 /*level 2 categorical vars*/
    model Y = L1_var1 L1_var2 L1_var3 /*level 1 variables*/ L2_var1 L2_var2  /*level 2 variables*/

              /dist= gamma link=log solution;
    random intercept / subject = GeoID type=un solution;
    random intercept / subject = SchoolID (GeoID) type=un solution;
    random intercept / subject = StudentID(SchoolID GeoID) type=un solution;
run;

 

What's the differences when I just have

RANDOM intercept /Subject=GeoID; RANDOM intercept /Subject=SchoolID(GeoID), or

RANDOM intercept /Subject=GeoID; RANDOM intercept Subject=SchoolID

 

If I want to assume random slope for level 2 variables, do I just 

RANDOM intercept /Subject=GeoID;

RANDOM intercept L2_var1 L2_var2 / Subject=SchoolID

?

 

Sorry for those very basic GLIMMIX questions. Any reply is appreciated.Thanks.

 

sas-innovate-2024.png

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.

 

Register now!

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
  • 0 replies
  • 1210 views
  • 0 likes
  • 1 in conversation