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

Hi Everyone,

 

I was just wondering whether there is a way to display letters on multiple comparison in SAS while having triple interaction in the model.

Suppose this is the model:

Y=A+B+C+A*B*C

A, B, and C each with 4 levels; therfore, there will be 64 mean comparisons.

 

Using LINES and SLICE statment is not working properly.

 

I would appreciate any suggestion

Sharam

1 ACCEPTED SOLUTION

Accepted Solutions
lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

Many statisticians would argue that you should not do all three-way comparisons, but limit comparisons to slices within other factors when there are interactions. If you really need to do the 3-way comparisons, then create a three-way variable in a data step (where each level represents a unique combination of the three factors), and do the anova using just this variable (I am assuming that this high level interaction is significant). Then you will not have any trouble getting the results in %mult.

View solution in original post

7 REPLIES 7
ballardw
Super User

"Not working properly" is awful vague.

Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.

No output? Post any log in a code box.

Unexpected output? Provide input data in the form of a dataset, the actual results and the expected results. Data should be in the form of a data step. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

shnias83
Calcite | Level 5

Thanks for your reply.

Yes, I should have explained it better.

 

I'm using SAS 9.4 version. There is no error in Log page. However, in the output when the mean comparisons is done at the end of the table I'm seeing this:

" The LINES display does not reflect all significant comparisons. The following additional pairs are significantly different: (15,32) (15,35) (15,31) (30,26) (30,8) (3,26) (3,8) (23,26) (23,8) (2,26) (2,8) (5,26) (5,8) (9,26) (9,8) (24,26) (24,8) (16,26) (16,8) (33,26) .... "

 

My data set is attached here, and the command line that I used is as below:

 

PROC glm data=trial;
CLASS   Group   Dose   AA ;
MODEL   First   Second   Total  =  Group  Dose  AA   Group*Dose*AA / ss3;
lsmeans   Group*Dose*AA / lines pdiff tdiff stderr adjust=tukey;;
RUN;

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

The program is working properly. You get the message because your lsmeans (or really their differences) have very unequal standard errors. That means that two means that are far apart might be not significantly different, but two means closer together (inside the extremes) might actually be signficantly different. This messes up the lines display. GLIMMIX/PLM takes a conservative approach for the lines, and then gives the warning message about the additional differences. The only way I know of getting all comparisons on the same table is to use Piepho's algorithm, which requires that you run a sas macro that he wrote (using stored lsmeans and mean differences). See the following links. But note: you will get a messy output, potentially, since some close means will show differences, but means farther apart will show no difference.

 

See:

http://agrobiol.sggw.waw.pl/~cbcs/articles/CBCS_7_1_2.pdf

http://www.akt.tu-berlin.de/fileadmin/fg34/publications-akt/letter-displays-csda06.pdf

http://amstat.tandfonline.com/doi/citedby/10.1198/1061860043515

 

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

I just realized that you are using GLM; I highly recommend that you use GLIMMIX. Your unequal "standard errors" are due to Tukey method. I recommend that you use method=simulate in GLIMMIX.

shnias83
Calcite | Level 5

Ivm,

 

Thanks for your reply!

 

I have already tried %MULT macro sugested by Piepho (2012). It is a good one. However, it give comparisons only between two factors using 'by' statement. That means you can not have all the comparisons at the same time. For example in the case of my data, I have 3 factors (A with 2 levels, B with 2 levels, and C with 9 levels) which I need to compare 36 (2x2x9) means simultaneously, but %MULT macro give sort of comparison like comparing 9 levels of C in only one level of the other factors. Such comparison can also be easily done by just changing the data structure and using GLM including 'lines'. Therefore, I'm reaching this conclusion that probably I cannot have all the comparisons altogether at one table using SAS, unless there is a way that I'm not aware of.

 

Thank you again for your help.

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

Many statisticians would argue that you should not do all three-way comparisons, but limit comparisons to slices within other factors when there are interactions. If you really need to do the 3-way comparisons, then create a three-way variable in a data step (where each level represents a unique combination of the three factors), and do the anova using just this variable (I am assuming that this high level interaction is significant). Then you will not have any trouble getting the results in %mult.

shnias83
Calcite | Level 5

 

Thanks so much for your support!

Yes, I think at the end I should combine my three fixed effects together as if I have only one fix effect to make the model simpler.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 7 replies
  • 3698 views
  • 2 likes
  • 3 in conversation