# [R] syntax for estimable(gmodels package) and glht(multcomp package)

Robert Wilkins robstdev at gmail.com
Tue Oct 27 03:20:59 CET 2009

```Hello,

I have a question as to how the syntax for glht(package multcomp) and
estimable (gmodels) works, since I'm not getting everything from the
documents I've googled so far, especially with models with 2nd order
terms.

A modestly complex model:
2-way anova with one continuous covariate, no random effects(and no
repeated measures) to keep it modestly complex:
Y = treatmentgroup + sex  + treatmentgroup*sex + weight

treatment has 3 levels : "Placebo" , "DrugA" , "DrugB"
sex has 2 levels

I want to do pairwise comparison(s) for one of the main effects, say
"DrugB" - "Placebo"

And a pairwise comparison at the cell-wise level, for example:
"Female:DrugA" - "Female:Placebo" or
"Female:DrugA" - "Male:DrugA"

The second request is not ambiguous since it's a difference of two
cells, (although the syntax for this request might be simplified if
the main first-order effects are constrained to zero ).

and suppose the marginal sums of the 2nd order terms sum to zero,
both down and across, that should make the first request non-ambigous.

Two things:
1: people in the mail list are having difficulties dealing with
interaction terms with both functions ( I see from googling ) and the
available PDFs don't explicitly deal with these cases.

2: specifying the desired estimate with actual categorical levels in
the calling syntax would be really nice:
i.e.  "Female:DrugA" - "Male:DrugA" , instead of something like ( 0 0
1 -1 0 0 ) , which to me is less intuitive and more prone to error.
One of the PDF s on the internet seem to suggest that estimable can do
this sort of thing for first order terms, but whether this extends to
two-way is not clear.

```