[R-sig-ME] Help with nested doubly repeated measures

Mike Lawrence Mike.Lawrence at dal.ca
Wed Sep 29 22:36:35 CEST 2010


No need to average across trials, best to leave trials in so that the
model take into account that variance and possibly improve power. You
might even add trial number as a variable in the model if you think
there might be consistent changes across trials, though I'm not sure
if it's better to include it as a numeric variable or a factor; the
latter might be better if you expect non-linearity of the effect of
trial.

fit = lmer(
    formula = latency.s.~ Treatment*BeamSize*Trial +
        (1|ID)
    , data = dat
    , na.action = na.omit
)

Since you're dealing with latencies, you should check that the
residuals are normal and if not, consider transforming latency with a
reciprocal or log.

Regarding combining your latency measure with foot slips, this sounds
similar to the problem of integrating speed and accuracy data from
experiments on human response time. In both domains you might
reasonably expect speed and accuracy to potentially trade-off; if
speed goes up but accuracy goes down between two conditions, a
speed-accuracy trade-off (SAT) has occurred. In some circumstances,
SATs are far less interesting than true changes in performance that
manifest when either only one variable changes or both variables
change in the same direction. Unfortunately, there is no solid answer
on how to appropriately combine speed and accuracy measures, so it's
probably best to model them separately and compare the outcomes to
look for SATs.



On Wed, Sep 29, 2010 at 5:21 PM, Nicholas Lewin-Koh <nikko at hailmail.net> wrote:
> I was thinking of it more like a split-plot, where each mouse
> gets a treatment (whole plot),
> and within each mouse  there is a set of treatments, beams and
> the trials
> are the replicates. So yes I can see that the beams are fixed,
> and all
> mice are tested on the same beams ie crossed. Each mouse gets
> three
> trials on each beam, 9 trials altogether. I could average the
> trials on each beam
> by mouse, which would make the model easier to fit. So that would
> be
>
> lmer(latency.s.~ Treatment*BeamSize +
> (1|ID),data=dat,na.action=na.omit)
>
> But I would still like to understand how to fit the full model in
> R. My data is structured
> as follows:
>  dat[1:10,]
>           newID     falls      footslips Sex  GT Treatment
> ID. BB.age
> 1  2596-1802.L.1     0         0 M     pos         V  2596-1802
> 17.1
> 2  2596-1802.L.2     0         0 M     pos         V  2596-1802
> 17.1
> 3  2596-1802.L.3     0         1 M     pos         V  2596-1802
> 17.1
> 4  2596-1802.M.1     0         1 M     pos        V  2596-1802
> 17.1
> 5  2596-1802.M.2     0         2 M     pos        V  2596-1802
> 17.1
> 6  2596-1802.M.3     0        13 M     pos       V  2596-1802
> 17.1
> 7  2596-1802.S.1     0        15 M     pos        V  2596-1802
> 17.1
> 8  2596-1802.S.2     0         7 M     pos         V  2596-1802
> 17.1
> 9  2596-1802.S.3     0         5 M     pos         V  2596-1802
> 17.1
> 10 2596-1804.L.1     0         0 F     pos         T  2596-1804
> 17.4
>   traverses.beam BeamSize latency.s. TrialNo
> 1         on toes        L                 11.40       1
> 2         on toes        L                 17.31       2
> 3         on toes        L                 21.87       3
> 4         on toes        M                37.81       1
> 5         on toes        M                21.84       2
> 6         on toes        M                25.96       3
> 7         on toes        S                 40.03       1
> 8         on toes        S                 68.72       2
> 9         on toes        S                 61.18       3
> 10                             L                26.03       1
>
> Nicholas
> On Wed, 29 Sep 2010 11:46 -0700, "Dennis Murphy"
> <djmuser at gmail.com> wrote:
>
>  Hi:
>
> On Wed, Sep 29, 2010 at 10:47 AM, Nicholas Lewin-Koh
> <[1]nikko at hailmail.net> wrote:
>
>  Hi Folks,
>  I have an experiment with about 80 mice. Mice were randomized
>  to
>  treatment and control arms. The experiment consisted of 3
>  balance beams,
>  Wide, Medium and Narrow. The mice were each given 3 trials on
>  each
>  balance beam (no not in random order). So the beam should get
>  sequentially harder as it gets narrower. The responses were
>  the latency,
>  the time to cross the beam and the number of footslips as they
>  crossed
>  the beam. So I have beam nested in mouse and trial nested in
>  beam. I
>  tried the following model:
>
> The only way beam is nested within mouse is if different sets of
> beams
> were used for different mice. If all mice used the same set of
> beams, then
> mice and beams are crossed factors. Recall that factor B is
> nested within
> factor A if each level of B is associated with exactly one level
> of A.
> Conversely, A and B are (completely) crossed if each level of A
> occurs
> in combination with each level of B.
> As far as the trials go, each mouse gets three trials, so if
> trial were to be
> nested within anything, it would have to be the mouse. The key
> question
> is what is the experimental unit - the mouse or the beam?
> Now that I think about it, each trial uses a different beam, so
> beam and
> trial are confounded, no? If that's the case, the model gets much
> simpler...
> HTH,
> Dennis
>
>  lmer(latency.s.~ Treatment + BeamSize +
>  (1|ID./BeamSize/TrialNo),data=dat,na.action=na.omit)
>  Error: length(f1) == length(f2) is not TRUE
>  In addition: Warning messages:
>  1: In TrialNo:(BeamSize:ID.) :
>   numerical expression has 827 elements: only the first used
>  2: In TrialNo:(BeamSize:ID.) :
>   numerical expression has 827 elements: only the first use
>  But I am not sure that this is the "right" way to specify this
>  model.
>  Ideally
>  There are two questions. 1) Is the overall marginal latency
>  lower in the
>  treated animals, and 2) is the Beam size Slope
>  for treated animals shallower than for untreated animals. I
>  have looked
>  at Park and Lee (2002) Statistics in Medicine 23:143-164, who
>  give SAS
>  code for a similar model. However, I am not very good at
>  translating SAS
>  to lme/lme4.
>  Once I have this figured out, is it possible to jointly model
>  foot slips
>  and latency?
>  Thanks for any input.
>  Nicholas Lewin-Koh
>  Senior Statistical Scientist
>  Genentech
>  _______________________________________________
>  [2]R-sig-mixed-models at r-project.org mailing list
>  [3]https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
> References
>
> 1. mailto:nikko at hailmail.net
> 2. mailto:R-sig-mixed-models at r-project.org
> 3. https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> 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