BookmarkSubscribeRSS Feed
Celine_France
Calcite | Level 5
Good morning everybody,

I want to analyze a comparison such as T0 vs T2h vs T4h for a group of young people.

My variables are : group = baby or child or teenager and time = T0 or T4h. Since my response is multinomial, I prefer to use proc genmod instead of proc mixed.

To make this comparison, I use this code :
proc genmod data=&tab;
class group time volunteer;
model &response = group time group*time/ dist=multinomial type3;
repeated subject=group(volunteer);
estimate 'Baby vs Child vs Teenager at T0' group 1 -1 0 group*time 1 0 -1 0 0 0 group 1 0 -1 group*time 1 0 0 0 -1 0 group 0 1 -1 group*time 0 0 1 0 -1 0;
contrast 'Baby vs Child vs Teenager at T0' group 1 -1 0 group*time 1 0 -1 0 0 0 group 1 0 -1 group*time 1 0 0 0 -1 0 group 0 1 -1 group*time 0 0 1 0 -1 0/e;
run;

If I separate the comparison with , it indicates an error (but, with mixed procedure, I think that I used to separate the comparison with comma). Are multiple comparisons possible with genmod procedure ?
With this code, SAS understand only the first part of the code "group 1 -1 0 group*time 1 0 -1 0 0 0" and doesn't make the complete comparison.

Have you got an idea of how I can write this comparison ?

By advance, thanks a lot,

Céline
2 REPLIES 2
StatDave
SAS Super FREQ
Céline,

You should be able to use commas in the CONTRAST statement to create a 2 DF test. But you cannot use them in the ESTIMATE statement.

contrast 'Baby vs Child vs Teenager at T0' group 1 -1 0 group*time 1 0 -1 0 0 0 , group 1 0 -1 group*time 1 0 0 0 -1 0 , group 0 1 -1 group*time 0 0 1 0 -1 0;

See the description of the CONTRAST and ESTIMATE statements in the GENMOD documentation:

9.1: http://support.sas.com/onlinedoc/913/getDoc/en/statug.hlp/genmod_index.htm
9.2: http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/genmod_toc.htm

But if you want multiple comparisons, you would presumably want separate CONTRAST statements for each of the three comparisons so that you get a separate 1 DF test for each pairwise group comparison.

contrast 'Baby vs Child at T0' group 1 -1 0 group*time 1 0 -1 0 0 0;
contrast 'Baby vs Teenager at T0' group 1 0 -1 group*time 1 0 0 0 -1 0;
contrast 'Child vs Teenager at T0' group 0 1 -1 group*time 0 0 1 0 -1 0;

Note that you might find it more convenient to write an equivalent model that has parameters that are more directly interpretable. For example:

model &response = time group(time) / dist=mult;

The 1st parameter of the nested effect compares the 1st and 3rd groups in the 1st time. The 2nd parameter compares the 2nd and 3rd groups in the 1st time. And similarly for the 4th and 5th parameters.
Celine_France
Calcite | Level 5
Thanks a lot for your help !

The contrast works very well with commas ! I will do the comparison 2 by 2 only if the "big" contrast is significant.
I don't know why the estimate doesn't work... maybe because of the multinomial distribution ? I used to program the 2 each time but in fact, I'm only interested in the contrast result, so it's great.

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
  • 2 replies
  • 1912 views
  • 0 likes
  • 2 in conversation