[R] contrast matrix in package multcomp
Torsten Hothorn
Torsten.Hothorn at rzmail.uni-erlangen.de
Thu Jun 27 09:11:09 CEST 2002
> Hi,
>
> I've got a problem building a contrast matrix for the Dunnet contrast in
> package multcopm. The following works fine:
>
> > summary(simtest(adiff ~ trial))
>
> Simultaneous tests: Dunnett contrasts
>
> Data: adiff by trial
>
> Contrast matrix:
> trial1 trial2 trial3 trial4 trial5
> trial2-trial1 -1 1 0 0 0
> trial3-trial1 -1 0 1 0 0
> trial4-trial1 -1 0 0 1 0
> trial5-trial1 -1 0 0 0 1
>
>
> Absolute Error Tolerance: 0.001
>
> Coefficients:
> Estimate t value Std.Err. p raw p Bonf p adj
> trial3-trial1 0.745 -2.911 0.256 0.006 0.025 0.021
> trial2-trial1 -0.688 -2.686 0.256 0.011 0.033 0.029
> trial4-trial1 0.091 -0.357 0.256 0.724 1.447 0.912
> trial5-trial1 0.032 -0.127 0.256 0.900 1.447 0.912
>
> But now I want to test trial3 against all other trials and build the
> following contrast matrix C:
>
> > C
> [,1] [,2] [,3] [,4] [,5]
> [1,] 1 0 -1 0 0
> [2,] 0 1 -1 0 0
> [3,] 0 0 -1 1 0
> [4,] 0 0 -1 0 1
>
> but I got the error:
>
> > summary(simtest(adiff ~ trial, cmatrix=C))
> Error in simtest.formula(adiff ~ trial, cmatrix = C) :
> dimensions of x and cmatrix do not match
>
> Does anybody know what went wrong?
>
yes. We check if the dimensions of the design matrix and the contrast
matrix match before we use it.
You specified a model WITH intercept and your contrast matrix is WITHOUT
intercept. try `cmatrix = cbind(0, C)', this is what `contrMat' does per
default. We do not print the column for the
intercept in summary(simint(...)) to avoid confusion but this might not
work. Seems to be suboptimal, we'll think about it.
Torsten
btw: could be please at least cc to the maintainer?
> Thanks, Sven
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
mailing list