Re: [R] Tukey HSD test using Multcomp

From: Mark Difford <>
Date: Fri, 25 Mar 2011 02:10:47 -0700 (PDT)

Mar 25, 2011; 12:58am Simon Bate wrote:

>> I've been happily using the TukeyHSD function to produce Tukeys HSD tests
>> but have decided to try
>> out Multcomp instead. However when I carry out the test repeatedly I have
>> found that Multcomp
>> produces slightly different values each time. (see code below).

The random number generator comes into this so you need to ?set.seed to get an identical result. Insert a set.seed statement in your code:

for (i in 1:20)

set.seed(3)                ## add this

mult<-glht(lm(Resp1~Treat1, data=statdata, na.action = na.omit), linfct=mcp(Treat1="Tukey"))
tabs=format(round(multp$test$pvalues, 6), nsmall=6, scientific=FALSE) print (tabs)

Regards, Mark.

View this message in context:
Sent from the R help mailing list archive at

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 25 Mar 2011 - 13:00:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 25 Mar 2011 - 13:10:24 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive