[R-lang] Dunnett test

Lngmyers lngmyers at ccu.edu.tw
Wed May 16 19:51:26 PDT 2007

Michael T Hammond wrote:

> Does anybody know if there is a way to get the "Dunnett test" (Dunnett,
> 1955) in R?
> I've found references to it in the "multcomp" package, but not the test
> per se.

My first response was -- with proper design, you don't have to worry 
about post hoc tests! But actually, comparing multiple things with a 
single control is pretty common in priming experiments....

Anyway, I think I may have figured it out, but I'll let the real experts 
check to be sure.

Look at the demo "recovery" in the "multcomp" manual. Modify the code 
like so, to make the test bidirectional with alpha = 0.05:

amod <- aov(minutes ~ blanket, data = recovery)
ht <- glht(amod, linfct = mcp(blanket = "Dunnett"))
confint(ht, level = 0.95)

This gives you the following 95% confidence intervals:

Linear Hypotheses:
              Estimate lwr      upr
b1 - b0 == 0  -2.1333  -6.1245   1.8578
b2 - b0 == 0  -7.4667 -11.4578  -3.4755
b3 - b0 == 0  -1.6667  -3.8685   0.5352

Notice that the function is treating b0 as the "control", since it's 
alphabetically the first level. The only comparison that has a 
confidence interval NOT crossing 0 (i.e. both signs are the same) is the 
one for b2, so that's the only significant comparison.

I compared this result with what's given by StatView for the same data, 
but with "b0" renamed as "zb0", since for some reason StatView treats 
the alphabetically LAST level as the control. Then I get:

Dunnett for minutes
Effect: blanket
Significance Level: 5 %
     Mean Diff.  Crit. Diff.	
b1  -2.133      3.928	
b2  -7.467      3.928       S
b3  -1.667      2.167	

Note that only b2 is marked "S" (significant).

Did I do this right...?

James Myers
Graduate Institute of Linguistics
National Chung Cheng University
168 University Road, Min-Hsiung
Chia-Yi 62102
Email:  Lngmyers at ccu.edu.tw
Web:    http://www.ccunix.ccu.edu.tw/~lngmyers/
Phone:  886-5-242-8251
Fax:    886-5-272-1654

International Workshop on Grammar & Evidence:

Try MiniJudge:

More information about the R-lang mailing list