Hi Josh,
 
Thanks for your reply. You're right about letting R's method dispatch system 
choose the method for summary and inserting more spaces in the code. I was just 
messing around with the code in the former case and forgot to change it back. 
As far as not having enough whitespace goes, I've been learning using The R 
Book and this may have caused me to learn some bad habits. I actually like The 
R Book a lot and have been able to learn a great deal from it. I've seen a few 
people comment about the lack of whitespace in the code though, and so this is 
something I'll need to change.
 
Your comment about editing the contrast matrix is interesting. I tried it out 
with my own code with the few moments I had this morning (see below). One thing 
I noticed immediately is that altering the contrast matrix, and then running 
the model, and then running Dunnett's test using multcomp doesn't work 
correctly. That is, the reference level for Dunnett's test is still "HI." If 
you use relevel though, the reference level for Dunnett's test is correct.
 
I haven't had time to investigate this yet. I get the impression though that 
editing the contract matrix is somewhat like using the "ref=" option in SAS 
procedures in that the change in the reference parameter doesn't (necessarily) 
carry over into subsequent analyses. That was one of the things I thought was 
so great about relevel. You set the reference level once and it stays set until 
you decide to change it.
 
Anyway, this was very interesting and informative.
 
Thanks for your help.
 
Paul
 
connection <- textConnection("
101 LO 21  104 LO 18
106 LO 19  110 LO  .
112 LO 28  116 LO 22
120 LO 30  121 LO 27
124 LO 28  125 LO 19
130 LO 23  136 LO 22
137 LO 20  141 LO 19
143 LO 26  148 LO 35
152 LO  .  103 HI 16
105 HI 21  109 HI 31
111 HI 25  113 HI 23
119 HI 25  123 HI 18
127 HI 20  128 HI 18
131 HI 16  135 HI 24
138 HI 22  140 HI 21
142 HI 16  146 HI 33
150 HI 21  151 HI 17
102 PB 22  107 PB 26
108 PB 29  114 PB 19
115 PB  .  117 PB 33
118 PB 37  122 PB 25
126 PB 28  129 PB 26
132 PB  .  133 PB 31
134 PB 27  139 PB 30
144 PB 25  145 PB 22
147 PB 36  149 PB 32
")
 
gad <- data.frame(scan(connection,
   list(patno=0, dosegrp="", hama=0), na.strings="."))
 
#### ANOVA ####
 
#gad$dosegrp <- relevel(gad$dosegrp, 3)
#contrasts(gad$dosegrp) <- contr.treatment(n = 3, base = 3)
model1 <- aov(hama ~ dosegrp, data = gad)
summary(model1)
 
#### Dunnett's Test ####
 
library(multcomp)
cht <- glht(model1, linfct = mcp(dosegrp = "Dunnett"))
summary(cht, test = univariate())



        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to