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

Hello SAS users,

 

I am trying to add a level-1 predictor to my model and i am trying to allow the slopes of this predictor to vary across schools (ie random slopes).

I have written three codes for this but i am confused at which one it is. As all three gave me outputs. Can anyone who is familiar with proc mixed help me out? 

Thanks!

proc mixed data=me method= reml covtest ;
class school;
model y = ses / s ddfm=bw cl;
random intercept ses / subject=school g type=un s;
run;

OR
proc mixed data=me method= reml covtest ;
class school;
model y = ses / s ddfm=bw cl;
random intercept  / subject=school g type=un s;
run;

OR
proc mixed data=me method= reml covtest ;
class school;
model y = ses / s ddfm=bw cl;
random  ses / subject=school g type=un s;
run;


1 ACCEPTED SOLUTION

Accepted Solutions
tellmeaboutityo
Obsidian | Level 7

The first one, it gives both random intercepts and random slopes. The second gives random intercepts only. The third gives random slopes with a fixed intercept, which is probably almost never useful; although for that reason it may default to random slopes and intercepts, and the results would be the same as the first. 

As an aside, technically it’s best practice to only add random slopes it they significantly improve your model fit over random intercepts only. It’s a matter of parsimony.

View solution in original post

1 REPLY 1
tellmeaboutityo
Obsidian | Level 7

The first one, it gives both random intercepts and random slopes. The second gives random intercepts only. The third gives random slopes with a fixed intercept, which is probably almost never useful; although for that reason it may default to random slopes and intercepts, and the results would be the same as the first. 

As an aside, technically it’s best practice to only add random slopes it they significantly improve your model fit over random intercepts only. It’s a matter of parsimony.

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
  • 1 reply
  • 701 views
  • 1 like
  • 2 in conversation