[R] multcomp and lme

Torsten Hothorn Torsten.Hothorn at rzmail.uni-erlangen.de
Tue May 6 12:35:32 CEST 2003

> I suppose that multcomp in R and multicomp in S-Plus are related

not really, there are huge differences.

> and it
> appears that it is possible to use multicomp with lme in S-Plus given
> the
> following correspondence on s-news
> sally.rodriguez at philips.com     12:57 p.m. 24/04/03 -0400        7
> [S] LME
> summary
> and multicomp.default()
> Is it possible to use multicomp with lme in R and if so what is the
> syntax
> from a simple readily available example such as the data frame HR in the
> library SASmixed?.

it is possible, yes, but you have to do some extra work. The package
offers two low-level functions `csimint' and `csimtest' which compute
adjusted p-values based on the estimated effects and their covariance
matrix. That means that you have to

1) compute the appropriate contrast matrix (maybe using `contrMat')
2) define the contrasts of the factor of interest (there is a section
   in MASS on how to do it)
3) fit the model
4) and compute the covariance matrix via `vcov'

and you have everything you need to proceed. I attach a short example
using glm, lme should be along the same lines...






# a factor at three levels
group <- factor(c(rep(1,10), rep(2, 10), rep(3,10)))

# Williams contrasts
contrasts(group) <- mginv(contrMat(table(group), type="Will"))

# a binary response
z <- factor(rbinom(30, 1, 0.5))

# estimate the model
gmod <- glm( z ~ group, family=binomial(link = "logit"))

# exclude the intercept
summary(csimtest(coef(gmod)[2:3], vcov(gmod)[2:3,2:3],
                 cmatrix=diag(2), df=27))

> Thank you very much.
> Peter B.

|									|
|	Dipl.-Stat. Torsten Hothorn					|
|	Institut fuer Medizininformatik, Biometrie und Epidemiologie	|
|	Waldstrasse 6, D-91054 Erlangen, Deutschland			|
|	Tel: ++49-9131-85-22707	(dienstl.)				|
|	Fax: ++49-9131-85-25740						|
|	Email: Torsten.Hothorn at rzmail.uni-erlangen.de			|
|	Web: http://www.imbe.med.uni-erlangen.de/~hothorn		|

More information about the R-help mailing list