[R] Post hoc tests with lme

From: Gang Chen <gangchen6_at_gmail.com>
Date: Wed, 16 Apr 2008 12:00:56 -0400


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)

Linear mixed-effects model fit by REML
  Data: ergoStool

       AIC BIC logLik
  133.1308 141.9252 -60.5654

Random effects:
 Formula: ~1 | Subject

        (Intercept) Residual
StdDev: 1.332465 1.100295

Fixed effects: effort ~ Type - 1

           Value Std.Error DF  t-value p-value
TypeT1  8.555556 0.5760123 24 14.85308       0
TypeT2 12.444444 0.5760123 24 21.60448       0
TypeT3 10.777778 0.5760123 24 18.71102       0
TypeT4  9.222222 0.5760123 24 16.01046       0
 Correlation:
       TypeT1 TypeT2 TypeT3
TypeT2 0.595

TypeT3 0.595 0.595
TypeT4 0.595 0.595 0.595

Standardized Within-Group Residuals:

        Min Q1 Med Q3 Max -1.80200345 -0.64316591 0.05783115 0.70099706 1.63142054

Number of Observations: 36
Number of Groups: 9


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:



> library(gmodels)
> estimable(fm, rbind(c("TypeT1"=1), c("TypeT2"=1)))
Error in FUN(newX[, i], ...) :
  `param' has no names and does not match number of coefficients of model. Unable to construct coefficient vector
> glh.test(fm, rbind(c("TypeT1"=1), c("TypeT2"=1)))
Error in glh.test(fm, rbind(c(TypeT1 = 1), c(TypeT2 = 1))) :   Only defined for lm,glm objects

> library(doBy)
> esticon(fm, rbind(c("TypeT1"=1), c("TypeT2"=1)))
Error in t(abs(t(tmp) * obj$fixDF$X)) :
  dims [product 2] do not match the length of object [4] In addition: Warning message:
In esticon.lme(fm, rbind(c(TypeT1 = 1), c(TypeT2 = 1))) :   The esticon function has not been thoroughly teste on 'lme' objects

> library(car)
> linear.hypothesis(fm, rbind(c("TypeT1"=1), c("TypeT2"=1)))
Error in L %*% b : requires numeric matrix/vector arguments


So is there any other package with which I can run this kind of tests?

Thanks,
Gang



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 16 Apr 2008 - 16:05:09 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 17 Apr 2008 - 05:30:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive