[R] post hoc test for lme using glht ?

SNAFU1 robertleobaker at yahoo.com
Thu Jul 22 00:36:26 CEST 2010


Hi,

I have a fairly simple repeated measures-type data set I've been attempting
to analyze using the lme function in the nlme package.  Repeated searches
here and other places lead me to believe I have specified my model
correctly.  

However, I am having trouble with post-hoc tests.  From what I gather, other
people are successfully using the glht function from the multcomp package to
perform post-hoc tests.  I've tried multiple iterations, but can't seem to
get it to work.  Here is (a subset of) what I have been trying.  Any help
would be greatly appreciated:

> model.3<-lme(fixed=Totnum~Wk*Pop, random=~1|nUID, data=nona) 
#Wk has 6 levels, 0-5; Pop has 2 levels; nUID is a unique ID given to each
individual (multiple individuals from each population were re-measured each
week)
> anova(model.3)
            numDF denDF  F-value p-value
(Intercept)     1   592 649.7753  <.0001
Week            5   592 302.9706  <.0001
Pop             1   222  70.7268  <.0001
Week:Pop        5   592  36.8576  <.0001
> summary(glht(model.3, linfct=mcp(Wk = "Tukey")))
Error in mcp2matrix(model, linfct = linfct) : 
  Variable(s) ‘Wk’ of class ‘integer’ is/are not contained as a factor in
‘model’.
> is.factor(Wk)
[1] FALSE
> Week<-factor(Wk)
> is.factor(Week)
[1] TRUE
> model.3<-lme(fixed=Totnum~Week*Pop, random=~1|nUID)
> summary(glht(model.3, linfct=mcp(Week = "Tukey")))
Error in contrMat(table(mf[[nm]]), type = types[pm]) : 
  less than two groups

Thanks,

Rob

-- 
View this message in context: http://r.789695.n4.nabble.com/post-hoc-test-for-lme-using-glht-tp2297882p2297882.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list