[R] output from multcomp and lm
John Fox
jfox at mcmaster.ca
Tue Feb 3 14:04:00 CET 2004
Dear Hiroto,
The anova() function reports a sequential analysis of variance, so the test
for Cond ignores the covariate. A good guess is that the effect of Cond
isn't significant controlling for the covariate. You could instead use
drop1() or Anova() in the car package.
I hope that this helps,
John
At 10:46 AM 2/3/2004 +0900, Hiroto Miyoshi wrote:
>Dear R-users
>
>I analysed the same data set by two different ways;
>analysis of covariance by using lm and anova functions
>and multiple comparison by using simtest function in
>the multcomp library.
>
>The output from the analysis of covariance is;
>
> > y<-lm(D~Cond+Q1,data=x)
> > anova(y)
>Analysis of Variance Table
>
>Response: D
> Df Sum Sq Mean Sq F value Pr(>F)
>Cond 2 1017.8 508.9 4.7548 0.0135041 *
>Q1 1 1652.7 1652.7 15.4417 0.0002969 ***
>Residuals 44 4709.2 107.0
>---
>Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
>
>where Cond is a factor with three levels (A,B,C)
>and Q1 is a covariate.
>
>
>
>Now, simtest showed the following output
>
> > o5<-summary(simtest(D~Cond+Q1,conf.level=0.95,data=x,type="Tukey"))
> > o5
>
> Simultaneous tests: Tukey contrasts
>
>Call:
>simtest.formula(formula = D ~ Cond + Q1, data = x, conf.level = 0.95,
> type = "Tukey")
>
> Tukey contrasts for factor Cond, covariable: Q1
>
>Contrast matrix:
> CondA CondB CondC
>CondB-CondA 0 -1 1 0 0
>CondC-CondA 0 -1 0 1 0
>CondC-CondB 0 0 -1 1 0
>
>
>Absolute Error Tolerance: 0.001
>
>Coefficients:
> Estimate t value Std.Err. p raw p Bonf p adj
>CondB-CondA 5.555 -1.461 3.802 0.151 0.453 0.319
>CondC-CondB -5.248 -1.365 3.661 0.179 0.453 0.319
>CondC-CondA 0.306 -0.084 3.844 0.934 0.934 0.934
>
>The results from two analyses seem so different that I am
>wondering why. I do understand that multiple comparison may
>not show any significant difference even when the overall analysis
>of (co)variance shows the statistical significance of a factor.
>
>However, in my analysis, overall analysis showed statistical significance of
>1.4% level and mutiple comparison showed significance of 32% level
>Could this happen? and why? Please enlighten me.
]
-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
More information about the R-help
mailing list