[R] What is my replication unit? Lmer for binary longitudinal data with blocks and two treaments.

hadley wickham h.wickham at gmail.com
Mon Jul 7 00:40:20 CEST 2008


Hi Humberto,

Instead of starting with a complicated model, how about producing some
graphics to aid your understand of the problem?  For this example, I'd
think it would be revealing to look at the proportion of positive
track plates that were positive.  If tracks was a variable that summed
up the number of positive tracks in each plot, I'd probably start with
something like:

library(ggplot)
qplot(time, tracks, data=mydf, facets = veget ~ fruit, group = block,
geom="line")

That will help you get a qualitative feel for what the model should
look like - what are the major effects?  is there a linear trend over
time?  how much variation is there? etc.  I don't think it's a good
idea to get a precise quantitative model until you have a good
qualitative feel for the problem.  Tukey puts it very well: "Far
better an approximate answer to the right question, which is often
vague, than an exact answer to the wrong question, which can always be
made precise."  With your current data analysis approach you are
likely to fall in the latter trap.

Hadley

On Sun, Jul 6, 2008 at 1:07 PM, hpdutra <hpdutra at yahoo.com> wrote:
>
> First I would like to say thank you for taking the time to read it.Here is my
> problem.
>
> I am running a lmer analysis for binary longitudinal (repeated measures)
> data.
> Basically, I  manipulated fruits and vegetation to two levels each(present
> and absent) and I am trying to access how these factors affect mice foraging
> behavior. The design consist of  12 plots, divided in 3 blocks.  So each
> block has 4 plots assigned to one of the following treatments.
> Fruit intact and Vegetation intact
> Fruit intact and Vegetation removed
> Fruit removed and Vegetation intact
> Fruit removed and Vegetation removed
>
> Within each plot I had 16 track plates. Track plates were checked monthly
> for presence or absence of paw prints. I am trying to fit lmer model
> track~fruit*vegetation*time*block in which fruit vegetation time are fixed
> effects and time is repeated measures and block is a random effect here is
> my code.
>
>> model<-lmer(track~veget*fruit*time*(time|plate)*(1|block),family=binomial)
>> summary(model)
> Generalized linear mixed model fit by the Laplace approximation
> Formula: track ~ veget * fruit * time * (time | plate) * (1 | block)
>   AIC   BIC logLik deviance
>  933.9 994.5 -454.9    909.9
> Random effects:
>  Groups Name        Variance    Std.Dev. Corr
>  plate  (Intercept)  0.226747   0.47618
>             time        0.054497   0.23345  -1.000
>  block  (Intercept)  0.615283 0.78440
> Number of obs: 1152, groups: plate, 192; block, 3
>
> Fixed effects:
>                                            Estimate Std.    Error         z
> value           Pr(>|z|)
> (Intercept)                                -1.68645    0.58718       -2.8721
> 0.00408 **
> vegetremoved                            -1.39291    0.57742       -2.4123
> 0.01585 *
> fruitremoved                               -0.54486    0.53765       -1.0134
> 0.31086
> time                                          -0.02091    0.10118
> -0.2067        0.83626
> vegetremoved:fruitremoved            0.75130    0.86342        0.8701
> 0.38422
> vegetremoved:time                       0.38229    0.14695        2.6014
> 0.00928 **
> fruitremoved:time                         0.17012    0.14227        1.1958
> 0.23178
> vegetremoved:fruitremoved:time    -0.47526    0.22134       -2.1473
> 0.03177 *
> ---
>
> OK, the method that I am using is Laplace and someone has pointed out that
> this is more accurate than PQL. I am still confused about the structure of
> the model though. I want time to be a fixed effects but I also want it to be
> repeated measures giving that I sample the same plates multiple times, this
> way I have time appearing twice in my model, is this correct?
> The variable plate is the identity of each of the 192 plates. But I am not
> sure if this is the correct approach, because this approach establishes that
> the plates are the replication unit and I wonder if I should use the plot as
> the replication unit? But if I do that then I change the approach from a
> binary data (the plate had a paw print or not) to continuos variable in
> which I would count the number of plates in plot that had paw print. I am
> not sure which is the best approach?
> Am I in the right track?
> Thanks
> Humberto
>
> PS: I would like to say that posted kind of the similar post before but
> addressing different questions. I deleted the previous post to avoid
> confusion
> --
> View this message in context: http://www.nabble.com/What-is-my-replication-unit--Lmer-for-binary-longitudinal-data-with-blocks-and-two-treaments.-tp18304494p18304494.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>



-- 
http://had.co.nz/



More information about the R-help mailing list