[R-sig-ME] my first random effects logistic regression
ONKELINX, Thierry
Thierry.ONKELINX at inbo.be
Wed Aug 18 10:40:37 CEST 2010
Dear Dieter,
You allready got the comments needed to get to code working. I would
like to point to a flaw in your random effect specification. The correct
specification for your design would be (1|farm/flock).
However I would model it in this case as (1|farm:flock) becasue you have
only 3 farms. Which is very low, so the variance estimates would not be
very reliable.
HTH,
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
> dieter.anseeuw
> Verzonden: woensdag 18 augustus 2010 9:29
> Aan: r-sig-mixed-models at r-project.org
> Onderwerp: [R-sig-ME] my first random effects logistic regression
>
> 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 at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
Druk dit bericht a.u.b. niet onnodig af.
Please do not print this message unnecessarily.
Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in this message
and any annex are purely those of the writer and may not be regarded as stating
an official position of INBO, as long as the message is not confirmed by a duly
signed document.
More information about the R-sig-mixed-models
mailing list