[R] Contrasts and MC
jfox at mcmaster.ca
Wed Jul 24 19:54:04 CEST 2002
At 10:00 AM 7/24/2002 -0500, Erin Hodgess wrote:
>I have a few questions about multiple comparisons
>and contrasts for ANOVA, please.
>I've tried some things but with no success.
>Suppose I have a completely randomized design,
>and I want to have the contrast
>\mu_1 - 0.5 \mu_2 - 0.5 \mu_2
>How do I set that up, please?
>I used the C command, and ran aov, but the results were identical to those
>with no contrasts.
C returns a new factor with the contrasts set as specified; unless you used
the new factor, or reassigned the result to the original one, there would
be no effect.
As well, by default, C creates one fewer contrast than the number of levels
of the factor, even if the matrix that you pass as an argument to C has
fewer columns; in this instance, the columns are filled out to be
orthogonal (in the basis) to those provided and to each other. You can,
however, specify the number of columns for the contrast matrix directly,
using the argument how.many.
It may also be slightly easier to simply assign to contrasts() for the
factor; for example:
> contrasts(fac) <- matrix(c(1, -0.5, -0.5), ncol=1)
> round(contrasts(fac), 3)
A 1.0 0.000
B -0.5 -0.707
C -0.5 0.707
> contrasts(fac, how.many=1) <- matrix(c(1, -0.5, -0.5), ncol=1)
(I assume that your factor has three levels, and that the second \mu_2 is a
>Also, is there a command for Dunne'ts multiple range test?
See the multcomp package.
>How about Scheffe's simultaneous intervals?
Not that I'm aware, but Scheffe intervals are very easy to construct since
they just use a different multiplier than the usual t-intervals.
I hope that this helps,
Department of Sociology
email: jfox at mcmaster.ca
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help