Hi Dieter, to fit a binomial glmm the response variable must be given by
either a two column matrix, number of success and number of trials, or as a
proportion vector (that is, between 0 and 1). Since you are using the last
option you should do something like this

broilers.dat$prop.pos <- with(broilers, positives/broilers)

model1<-glmer(prop.pos~1 + (flock|farm), data=broilers.dat,
family=binomial(link="logit"), weights=broilers)

#OR

model1<-glmer(cbind(positives, broilers) ~1 + (flock|farm),
data=broilers.dat, family=binomial(link="logit"))


I hope it helps since I haven't in 22 hours

Luciano


2010/8/18 dieter.anseeuw <dieter.anseeuw@katho.be>

> Hi all,
>
>
>
> I am new to using lme4 and only just discovered the mailing list (I already
> shortly introduced my problem in the epi-mailinglist, sorry for
> cross-posting, but my questions seem more appropriate for the mixed models
> discussion group).
>
>
>
> A friend has inspected three randomly chosen farms (random factor 'farm').
> At each farm three randomly chosen series of chickens (random factor 'flock'
> nested within 'farm') were each inspected for the presence of a certain
> bacteria. The contaminated chickens were counted (response variable
> 'positives'). The sample sizes per flock are given by the variable
> 'broilers'. We want to have a look at within-broilers, within-farm and
> between-farm variability.
>
>
>
> This is the closest I get to analysing her data:
>
>
>
> >
> broilers.dat<-data.frame(farm=c("FA","FA","FA","FB","FB","FB","FC","FC","FC"),
> flock=c("a","b","c","d","e","f","g","h","i"), broilers=c(50, rep(25,8)),
> positives=c(7,2,0,7,2,0,0,0,2))
>
> > library(lme4)
>
> > model1<-glmer(positives~1 + (flock|farm), data=broilers.dat,
> family=binomial(link="logit"), weights=broilers)
>
> Error in eval(expr, envir, enclos) : y values must be 0 <= y <= 1
>
>
>
> Hence, my code doesn't work. Could anybody help me out where and why I go
> wrong?
>
>
>
> Many thanks in advance,
>
> Dieter
>
>
>
> --
>
> Dr. Ir. Dieter Anseeuw
>
> Katho Campus Roeselare
>
> Wilgenstraat 32
>
> 8800 Roeselare Belgium
>
>
>
> Direct phone: +32 51 23 29 68
>
> http://www.katho.be/hivb
>
> http://www.linkedin.com/in/dieteranseeuw
>
>
>
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

	[[alternative HTML version deleted]]


