# [R-sig-ME] Post hoc tests with lme

Gang Chen gangchen6 at gmail.com
Thu Apr 17 17:41:50 CEST 2008

```Thanks for the suggestion, Somon! I did try glht from multcomp
package, but the problem is that for the hypothesis

H0: TypeT1 =0 and TypeT2 = 0

it gives results for two separate hypotheses H01: TypeT1 =0 and H02:
TypeT2 = 0, not exactly one statistic for the original hypothesis H0.
So my question is, how can I get only one statistic for H0? Any more
suggestions?

Thanks,
Gang

> library(nlme)
> fm <- lme(effort~Type-1, data=ergoStool, random=~1|Subject)
> library(multcomp)
> summary(glht(fm, linfct=c("TypeT1=0", "TypeT2=0")))

Simultaneous Tests for General Linear Hypotheses

Fit: lme.formula(fixed = effort ~ Type - 1, data = ergoStool, random = ~1 |
Subject)

Linear Hypotheses:
Estimate Std. Error z value p value
TypeT1 == 0    8.556      0.576   14.85  <1e-10 ***
TypeT2 == 0   12.444      0.576   21.60  <1e-10 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Adjusted p values reported -- single-step method)

On 4/16/08, Simon Blomberg <s.blomberg1 at uq.edu.au> wrote:
> Try glht in package multcomp.
>
>  Simon.
>
>
>  On Wed, 2008-04-16 at 12:00 -0400, Gang Chen wrote:
Using the "ergoStool" data cited in Mixed-Effects Models in S and
S-PLUS by Pinheiro and Bates as an example, we have

========
> library(nlme)
> fm <- lme(effort~Type-1, data=ergoStool, random=~1|Subject)
> summary(fm)

Now suppose I want to test the following hypothesis

H0: TypeT1 =0 and TypeT2 = 0

I've tried estimable() and glh.test() in package gmodels, esticon() in
package boBy, and linear.hypothesis() in package car, but it seems
none of them would work with objects from lme.

```