[R-sig-ME] lmer and post-hoc testing

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Tue Jan 11 09:54:30 CET 2011


Dear Shona,

Try converting Arena to a factor in your data.frame. And then run the
model below.

Your.data.frame$Arena <- factor(Your.data.frame$Arena)
model1<-lmer(y~Arena+SL+(1|FishID), family=binomial, data =
Your.data.frame)
glht(model1, linfct=mcp(Arena="Tukey"))

factor(Arena) and Arena are two different variables. That's what causing
your problem.

Best regards,

Thierry

------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium

Research Institute for Nature and Forest
team Biometrics & Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium

tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey
  

> -----Oorspronkelijk bericht-----
> Van: r-sig-mixed-models-bounces at r-project.org 
> [mailto:r-sig-mixed-models-bounces at r-project.org] Namens 
> SHONA MARY LESLIE
> Verzonden: maandag 10 januari 2011 17:54
> Aan: r-sig-mixed-models at r-project.org
> Onderwerp: [R-sig-ME] lmer and post-hoc testing
> 
> Hi there,
> 
> I am investigating habitat preference in 9-spined 
> sticklebacks using 4 experimental arenas (each fish spent 
> same time in each arena) and want to know whether the time in 
> the shallow area was different between arenas.
> 
> I carried out a generalised linear mixed model (using lmer), 
> putting in the fish ID as a random effect, and the 
> distribution as binomial (since it's proportion data); as follows...
> 
> > model1<-lmer(y~factor(Arena)+SL+(1|FishID), family=binomial)
> > summary(model1)
> 
> This worked but I can't work out how to run a Tukey test, to 
> see which arenas were different.  I have tried... (with error 
> message underneath)
> 
> > TukeyHSD(model1)
> Error in UseMethod("TukeyHSD") : 
>   no applicable method for 'TukeyHSD' applied to an object of 
> class "mer"
> 
> > summary(glht(model1,linfct=mcp(Arena="Tukey")))
> Error in summary(glht(model1, linfct = mcp(Arena = "Tukey"))) : 
>   error in evaluating the argument 'object' in selecting a 
> method for function 'summary'
> 
> > glht(model1, linfct=mcp(Arena="Tukey"))
> Error in mcp2matrix(model, linfct = linfct) : 
>   Variable(s) 'Arena' have been specified in 'linfct' but 
> cannot be found in 'model'! 
> 
> > glht(model1, linfct=mcp(factor(Arena)="Tukey")
> Error: unexpected '=' in "glht(model1, linfct=mcp(factor(Arena)="
> 
> I have read some of the R help archives and it has been 
> pointed out that Tukey may or may not work with lmer (I 
> downloaded the newest version and still no luck).  Any ideas? 
>  If Tukey won't work, are there others that might?
> 
> Thanks,
> Shona
> 
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list 
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> 




More information about the R-sig-mixed-models mailing list