BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
StatsMan
SAS Super FREQ

Here's a brief example of writing a CONTRAST or ESTIMATE when a random effect is involved:

 

proc glimmix data=test;
class a trt;
model y=trt x1 x2 x3 / s dist=bin link=logit ;
random intercept / subject=a s;
estimate 'diff a2-a3' | int 1 / subject 0 1 -1;
run;

 

Use the vertical bar to indicate that everything following represents the random effects in the model.  If you have a SUBJECT= identifier on the RANDOM statement, then use the forward slash and the SUBJECT keyword on the ESTIMATE statement to identify the subject coefficients you want to use.  The example here compares levels 2 and 3 of effect A.  

lotcarrots
Calcite | Level 5

Wow that's indeed interesting! That means with my code having a 3x3 cov matrix and a intercept (see picture), I can test whether my 7 variances are simultaneously equal to 0 or my 7th variance (i.e. the intercept of ID) equals 0.

 

PROC GLIMMIX DATA = ...;
CLASS SP Ver ZP TierID;
MODEL y = SP|ZP|Ver / DDFM=BETWITHIN;
RANDOM ZP / SUBJECT=TierID*SP*Ver TYPE=UN;
RANDOM int / SUBJECT=TierID solution;
covtest 0 0 0 0 0 0 0;
covtest . . . . . . 0;
estimate 'diff ID2-ID3' | int 1 / subject 0 1 -1;
RUN; QUIT;

 

Please don't bother with different naming - it's basically the same.

 

Unfortunately with two random statements I get an error for the the estimate statement:
"Contrasts between subjects require that all random effects have the same subject; the CONTRAST statement is ignored."

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 16 replies
  • 3579 views
  • 6 likes
  • 4 in conversation