On Jul 21, 2010, at 6:36 PM, SNAFU1 wrote:


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

Come on... are you cutting and pasting fro disjoint sections of your console? The formula says Wk and the parameter name in the anova result is Week. What gives?

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)

Well, this object should not even exist at the top level environment unless you attached it and didn't tell us about it.

Try:
Wk <- NULL
nona$Wk <- factor(nona$Wk)

Then re-run your code.


[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
--
David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@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.

Reply via email to