Hi all:
I have a question about multi-comparison.
 
The data is in the attachment.
 
My purpose:
Compare the predicted means of the 3 methods(a,b,c) pairwisely.
 
I have 3 ideas:
 
#idea1
result_aov<-aov(y~ method + x1 + x2)
TukeyHSD(result_aov)
     diff        lwr       upr     p adj
b-a  0.845  0.5861098 1.1038902 0.0000001
c-a  0.790  0.5311098 1.0488902 0.0000002
c-b -0.055 -0.3138902 0.2038902 0.8578386

#idea2
library(multcomp)
summary(glht(result_aov,linfct=mcp(method="Tukey")))
         Estimate Std. Error t value Pr(>|t|)
b - a == 0   0.3239     0.1402   2.309   0.0683 .
c - a == 0  -0.3332     0.1937  -1.720   0.2069
c - b == 0  -0.6570     0.1325  -4.960   <0.001 ***
 
#idea3
#ref=a
dat$method <- relevel(dat$method, ref="a")
lm_ref_a<-lm(y~method + x1 + x2)
summary(lm_ref_a)
Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept)  0.92202    0.64418   1.431   0.1647   
methodb      0.32389    0.14025   2.309   0.0295 * 
methodc     -0.33316    0.19372  -1.720   0.0978 . 
x1           0.57935    0.09356   6.192 1.78e-06 ***
x2           0.13596    0.11563   1.176   0.2507   
 
#ref=b
dat$method <- relevel(dat$method, ref="b")
lm_ref_b<-lm(y~method + x1 + x2)
summary(lm_ref_b)

Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept)  1.24591    0.73770   1.689   0.1037   
methoda     -0.32389    0.14025  -2.309   0.0295 * 
methodc     -0.65705    0.13248  -4.960 4.14e-05 ***
 

In summary:
idea1:
a vs b:pvalue=0.0000001
a vs c:pvalue=0.0000002
b vs c:pvalue=0.8578386
idea2:
a vs b:pvalue=0.0683
a vs c:pvalue=0.2069
b vs c:pvalue<0.001
idea3:
a vs b:pvalue=0.0295
a vs c:pvalue=0.0978
b vs c:pvalue=4.14e-05

So the result of 3 ideas are different,and I don't know which one is correct.
Many thanks for your help.

My best
 
method  x1      x2      y
a       4.1     5.3     3.95
a       4.6     5       4.35
a       4.8     6       4.55
a       5.4     6.2     4.7
a       5.2     6.1     4.9
a       5.7     5.9     4.9
a       6       6       5
a       5.9     6.1     5.5
a       4.2     5.2     4.05
a       4.6     5       4.3
b       5.5     6.2     5.1
b       5       7.1     5.3
b       6       7       5.5
b       6.2     6.1     5.65
b       5.9     6.5     5.7
b       5.2     6.8     5.4
b       6.4     7.1     5.95
b       5.4     6.1     4.95
b       6.1     6       5.55
b       5.8     6.4     5.55
c       6.1     7.1     5.05
c       6.3     7       5.2
c       6.5     6.2     5.45
c       6.7     6.8     5.55
c       7       7.1     5.85
c       6.5     6.9     4.9
c       7.1     6.7     6
c       6.9     7       4.9
c       6.7     6.9     5.35
c       7.2     7.4     5.85
______________________________________________
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