BookmarkSubscribeRSS Feed
Maicon
Calcite | Level 5

Hello!
How can I program the CONTRAST statment for decomposition of a 4x2 interaction by using linear and quadratic contrasts? The SAS code I'm performing just shown the main component "NIVEL" contrast.

proc glimmix data=WORK.IMPORT;
Class NIVEL ENZ;
Model CMMS = NIVEL ENZ NIVEL*ENZ/ddfm=kr;
Lsmeans NIVEL*ENZ/ adjust=tukey diff lines;
   contrast 'Linear'     NIVEL -0.67082 -0.223607 0.2236068 0.6708204;
   contrast 'Quadratico' NIVEL 0.5	-0.5	-0.5	0.5;
run;

The significant NIVEL*ENZ interaction should be decomposed in linear and quadratic contrasts of the LEVEL(0; 7.5; 15.0; or 22.5) component into the ENZ(0 or 1) component. Please, if anyone can help me! Thank you very much!

4 REPLIES 4
sbxkoenk
SAS Super FREQ

Post was moved to statistical_procedures board by me.

Koen

sbxkoenk
SAS Super FREQ

Just adding this:

 

Many contrast and estimate statements can be "avoided" by using : 

LSMEANS statement and / or LSMESTIMATE Statement and SLICE Statement.

Please use LSMEANS / LSMESTIMATE / SLICE statements where appropriate.

 

Should you still need a CONTRAST statement, these blogs may learn you something new :

Best regards,
Koen

StatDave
SAS Super FREQ

If you are saying that you want to assess the linear and quadratic effects of NIVEL and also whether those effects change depending on the level of ENZ, then you are saying that NIVEL is continuous and it can be removed from the CLASS statement. You can then fit the following model to assess the linear and quadratic effects of NIVEL and also their interactions with ENZ:

 

class enz;

model cmms = nivel nivel*nivel enz enz*nivel enz*nivel*nivel;

 

SteveDenham
Jade | Level 19

Try this:

 

proc glimmix data=WORK.IMPORT;
Class NIVEL ENZ;
Model CMMS = NIVEL ENZ NIVEL*ENZ/ddfm=kr;
Lsmeans NIVEL*ENZ/ adjust=tukey diff lines e;
   contrast 'Linear NIVEL at ENZ=0'     NIVEL*ENZ  -3 -1 1 3  0 0 0 0;
   contrast 'Quadratic NIVEL at ENZ=0' NIVEL*ENZ 1 -1 -1 1  0 0 0 0;
   contrast 'Linear NIVEL at ENZ=1'     NIVEL*ENZ  0 0 0 0  -3 -1 1 3;
   contrast 'Quadratic NIVEL at ENZ=0' NIVEL*ENZ 0 0 0 0   1 -1 -1 1;
run;

Since you are using CONTRAST rather than ESTIMATE, you can use integer coefficients.  If you want some output value, rather than just a p value, switch to LSMESTIMATE statements.

 

I added the 'E' option to your LSMEANS statement as a check on the arrangement of coefficients in the CONTRAST statements.

 

SteveDenham

 

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 16. 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
  • 4 replies
  • 672 views
  • 2 likes
  • 4 in conversation