2
$\begingroup$

When you collect data from participants in an experiment, sometimes you can collect repeated responses for the same condition, e.g., in R:

set.seed(2012) # keep the example the same each time.

data.full <- data.frame(id=gl(10, 4),
                        condition=gl(2, 40),
                        response=c(rnorm(40), rnorm(40, 1)))
head(data.full)

# Output:
#   id condition    response
# 1  1         1 -0.77791825
# 2  1         1 -0.57787590
# 3  1         1  0.66325605
# 4  1         1  0.08802235
# 5  2         1  1.25707865
# 6  2         1 -0.62977450

To analyse this (i.e. does condition predict response) I would normally take the mean response for each participant, for each condition. I would do this on the basis that we are supposed to be generalizing from a sample to a population, i.e. there should be one 'estimate' response from each participant for each condition, and the collection of these single responses (for each condition) is our sample, then we do an analysis which generalizes to the population.

I would transform the data e.g. like this:

library(plyr)
data.means <- ddply(data.full, .(id, condition),
                    summarize,
                    mean.response=mean(response))
head(data.means)

# Output:
#   id condition mean.response
# 1  1         1    -0.1511289
# 2  1         2     0.8658770
# 3  2         1     0.1510842
# 4  2         2     0.0129323
# 5  3         1     0.1857577
# 6  3         2     0.9859697

And then proceed with the within-subjects analysis (note the same process would apply if there were more conditions or a 2x2 design etc.), e.g.:

aov1 <- aov(mean.response ~ condition + Error(id/condition), data=data.means)
summary(aov1) # F = 4.2, p = .07, not significant

However, I've been told that with linear mixed-effects models, you can include all the underlying data on the basis that the lme models can include correlated data. My understanding was that they could include correlated data meant they could include responses from the same participants (within-subjects effects modelled as random effects), not that you could include the underlying data that gives the participant response estimate.

My question is, can you include the underlying data collected from the multiple responses of each participant in the same condition, i.e. can you do this:

library(nlme)
lme1 <- lme(response ~ 1, random= ~ 1|id/condition, data=data.full, method="ML")
lme2 <- update(lme1, .~. + condition)
anova(lme1, lme2)

# X(1) = 3.19, p = .07, not significant

Or should you do this:

lme1 <- lme(mean.response ~ 1, random= ~ 1|id/condition, data=data.means, method="ML")
lme2 <- update(lme1, .~. + condition)
anova(lme1, lme2)

# X(1) = 5.25, p = .02, significant

Which is the correct approach?

$\endgroup$
1
$\begingroup$

Not only can you use the repeated measure, you should. You'll note that the mixed model doesn't dramatically reduce the standard error when you include lots of repeated responses. That's a hint that it's at least not doing the traditionally wrong thing. You don't have to identify these multiple responses any special way in the formula.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.