[R] Tukey HSD test using Multcomp

Mark Difford mark_difford at yahoo.co.uk
Fri Mar 25 10:10:47 CET 2011


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")) 
multp<-summary(mult) 
tabs=format(round(multp$test$pvalues, 6), nsmall=6, scientific=FALSE) 
print (tabs) 
i=i+1 
}

Regards, Mark.

--
View this message in context: http://r.789695.n4.nabble.com/Tukey-HSD-test-using-Multcomp-tp3404038p3404906.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list