[R] Help with a more flexible funtion for multiple comparision of means

Jose Claudio Faria joseclaudio.faria at terra.com.br
Mon Sep 12 05:27:36 CEST 2005


Dear R-list,

Could anybody tell me (or give me a tip) of how to implement the Duncan 
distribution in R?

I've been trying to make a new and more flexible function for multiple 
comparison of means: Tukey, SNK and Duncan, from 'aov' objects, like TukeyHSD 
function.

For while, it is running nice (Tukey and SNK), for simple design (completely 
randomized, randomized block and Latin squares) and simple experimental schemes 
  (one factor).

I'm needing only two informations: 'qduncan' and 'pduncan',
similar to already available in R 'qtukey' and 'ptukey'. The basic algorithm 
implemented with SNK test will be used for Duncan test.

Below a sample:
a) Generating data and calling the function:

tra = gl(4, 5, label = c('A', 'B', 'C', 'D'))
blo   = rep(1:5, 4)
pro = c(NA, 26, 20, 23, 21, 31, 25, 28, 27, 24, 22, 26, NA, 25, 29, 33, 29, 31, 
34, NA)

x   = aov(pro ~ tra) #or x= aov(pro ~ blo + tra)
res = mctm(x, which='tra', test='SNK', conf.level=0.95)
print(res)

b) The R output:

$Table
Tables of means
Grand mean

26.70588

  tra
        A  B    C     D
     22.5 27 25.5 31.75
rep  4.0  5  4.0  4.00

$Ordered means
tra
     D     B     C     A
31.75 27.00 25.50 22.50

$Result
   D  B  C  A
D -  *  *  *
B *  - ns ns
C * ns  - ns
A * ns ns  -

$Test
[1] "SNK"

$Conf.level
[1] 0.95

$Mean differences
      D    B    C    A
D 0.00 4.75 6.25 9.25
B 4.75 0.00 1.50 4.50
C 6.25 1.50 0.00 3.00
A 9.25 4.50 3.00 0.00

$Minimum Significative Differences - MSD
      D    B    C    A
D 0.00 3.83 4.93 5.48
B 3.83 0.00 3.83 4.68
C 4.93 3.83 0.00 4.04
A 5.48 4.68 4.04 0.00

$Replicates number
     D   B   C   A
D   - 4:5 4:4 4:4
B 5:4   - 5:4 5:4
C 4:4 4:5   - 4:4
A 4:4 4:5 4:4   -

Thanks in advance,
-- 
Jose Claudio Faria
Brasil/Bahia/UESC/DCET
Estatistica Experimental/Prof. Adjunto
mails:
  joseclaudio.faria at terra.com.br
  jc_faria at uesc.br
  jc_faria at uol.com.br
tel: 73-3634.2779




More information about the R-help mailing list