7
$\begingroup$

I am in Psychology and trying to explore the utility of mixed modeling for analyzing my repeated-measures data in a factorial experiment. The primary reason for using mixed models is that I would like to avoid the common practice of averaging data collected in the same experimental condition. My understanding is that it's typically required for repeated-measures ANOVA that there is only one observation per condition per subject. What if you have several replications of the same condition for the same subject?

To be more concrete, I have two conditions a between-subjects factor A (2 levels) and a within-subjects factor B (3 levels). There are 4 repetitions of each level of B for a total of 12 randomized order trials per subject. Usually, I would simply average across these 4 to get an estimate for the performance of the subject in the condition and then run, but it seems that this way I'm throwing valuable information about variability. How to deal with such data using mixed modeling in R (I've been using lmer function). Maybe including trial number as another variable would work? I tried including trial # as a random factor together with the subject, but its estimated variance is very low compared to error and subject.

$\endgroup$
3
  • $\begingroup$ Can you clarify what you mean by typically required for repeated-measures ANOVA that there is only one observation per condition per subject ? I may be misunderstanding what you mean, but, I would think that the main point of mixed models is that you CAN have multiple measures per condition per subject $\endgroup$
    – Peter Flom
    Dec 20, 2012 at 18:45
  • $\begingroup$ I mean that in the standard ANOVA analysis for repeated-measures data one has to have only one observation per subject per cell. For example, if I'm measuring person's reaction time in a 2x2 factorial design, I would have multiple repetitions of the same exact combination of factors and then average across them for the ANOVA analysis (because their order is random for every participant). I think that my question is related to this one too: stats.stackexchange.com/questions/41420/… $\endgroup$ Dec 20, 2012 at 18:53
  • $\begingroup$ I don't think that you are correct in that it must be one observation per subject per level of the within-subject factor. In fact, I don't think that is a desirable situation, since then you cannot evaluate the subject*within-factor interaction. If you have replications, you can analyze it following a "fully replicated with nesting" model. You may want to check this book (compare models 6.3[unreplicated] and 3.3[replicated] with B' substituting for S' and C substituting for B) $\endgroup$
    – FairMiles
    Apr 4, 2013 at 20:13

2 Answers 2

4
$\begingroup$

Multi-level models (aka mixed models etc) are designed to deal with the case where you have multiple measures on one person.

In the typical 2x2 design (not repeated measures) you have multiple observations in each cell, but these are on different and unrelated subjects (people or whatever), thus, they are independent, and ANOVA or regression (both are the general linear model) are fine (provided other assumptions are met).

If you have repeated measures on each subject, those data are not independent. There are various ways to deal with this. One way is to average the data for each person, but this isn't a very good way. Much better methods are multi-level models or general estimating equations (GEE).

Unfortunately, the terminology here can get very confusing. Better to write equations.

The general linear model (regular ANOVA or regression):

$Y = X\beta + \epsilon $

where Y is a vector of the dependent variable, X a matrix of independent variables, $\beta$ a vector of parameters to be estimated and $\epsilon$ is error. This assumes that

$\epsilon \sim \text{iid } \mathcal{N}(0, \sigma) $

Multi-level:

$Y = X\beta + Z\gamma + \epsilon$

where Z is the (known) design matrix and $\gamma$ is a vector of random effect parameters. Assumes $\gamma \sim \mathcal{N} (0, \sigma) $ and that the covariance between $\gamma$ and $\epsilon$ is 0.

$\endgroup$
3
  • $\begingroup$ Thank you for the clarification. Is this a reasonable model in for the experiment that I described in the original question? m1 = lmer(DV ~ A * B + (1|Trial) + (1|Subject),data=data)? Where Trial is the trial number in the experiment overall (and could capture any fatigue effects). Or should individual repetitions be coded in some other way other than this (for example, rank order of occurrence of each repetition within the whole experiment)? Another question is how to deal with post-hoc level by level analysis on Factor B. I know that in multiple regression, you have to specify coding vector $\endgroup$ Dec 20, 2012 at 20:28
  • $\begingroup$ I am not sure; I mostly use SAS for this sort of thing. Others here are expert in R $\endgroup$
    – Peter Flom
    Dec 20, 2012 at 20:45
  • $\begingroup$ OK, thank you. I'll have to open another question about post-hoc comparisons within mixed models later on. $\endgroup$ Dec 20, 2012 at 22:05
4
$\begingroup$

I think that you don't have to include trial as a random factor (unless it makes any sense, but you said they were just repetitions in random order). You only have to declare subjects as a random factor and R will detect that you have 4 observations per subject*B cell. Check df in the output (if you use nlme) to confirm. In a classical ANOVA-design context, that will allow the evaluation of the B*subject interaction [i.e., if the within-factor effect differs enough among subjects].

I think the full model for that would be m1 = lmer(DV ~ A * B + (B|Subject), data=data) (if using lmer) or m1 = lme(DV ~ A * B), random= ~B|Subject, data=data (if using nlme)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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