[R] Analysing insecticide biossays using lmer

Ben Bolker bbolker at gmail.com
Thu Jun 30 20:48:40 CEST 2011


pierricklabbe <pierrick.labbe <at> univ-montp2.fr> writes:

> 
> Hi all,
> 
> Here is my problem: I performed bioassays using a unique insecticide on 9
> different genotypes and got their mortality depending on the dose of
> insecticide used.
> Now, I want to see wether some genotypes are different or not in their
> responses to insecticide.
> My problem is that I have up to four replicates for some genotypes, but only
> one for other... Due to this unbalanced design, I thought of using lmer
> procedure (lme4).
> 

  There are a few issues here.

(1) please send follow-ups to r-sig-mixed-models at r-project.org
(2) quasi- families are not available in recent versions of lme4:
you must have a pretty old version.  The current advice is to use
an observation-level random effect to capture overdispersion in GLMMs.
(3) the variables used in defining groups (i.e. the ones found to the
right of the | in the random-effects part of the formula) must be
factors.  If you want a random effect of the continuous dose variable
you need to put it on the *left* of the bar (this is the proximate cause
of your error message).  You could alternatively make logdose into
a factor, but with 18 unique values I don't think that's a good idea.

dataf <- read.table("insect.dat",header=TRUE)
library(lme4)

dataf$obs <- seq(nrow(dataf))

model1 <- lmer(cbind(mort,tot-mort)~logdose*geno-1+(logdose|geno)+(1|obs),
               family=binomial,data=dataf)

model0 <- update(model1,.~.-(1|obs))

AIC(model0,model1)

By the way, you should always look at your data ...

library(ggplot2)
library(mgcv)
ggplot(dataf,aes(x=logdose,y=mort/tot,colour=geno))+
  geom_point()+geom_smooth(method="gam",family=binomial,
     aes(weight=tot))



More information about the R-help mailing list