I know just enough about lme() and lmer() to get myself by with simple models, and to get myself into trouble with more complex ones. I'm really confused about the proper way to model some data I'm currently working with, and would be grateful for some help.

The question: do people give different estimates of a distance after being fatigued by exercise, and does ingesting sugar during the exercise change the relationship?

The setup: participants are shown a sequence of 3 targets at different distances, and asked to provide a distance estimate for each. They then exercise for a while, and then make 3 more distance estimates to 3 new target distances. This whole procedure happens twice for each participant, on separate days, and one day they ingest sugar, while on the control day they do not.

The data:

DV: Distance estimates


  • Actual distance: 6 possible distances
  • Condition: 2 level factor: treatment/placebo
  • Measurement occasion: 2 level factor: Pre/Post exercise

So, for each subject, I have:

  • 3 distance estimates before exercising w/ sugar
  • 3 distance estimates after exercising with sugar
  • 3 distance estimates before exercising w/out
  • 3 distance estimates after exercising w/out.

Ultimately, I'd like to know if the estimates people make post-exercise are different depending on the Condition, but those estimates should also be dependent on the starting point of Pre-exercise estimates. Since the actual target distances before and after are different, I can't do a direct comparison (the means of each group of 3 are the same, however).

The thing that is tripping me up is that both factors are within subjects. I have repeated measures at different levels (repeated estimates in each state, repeated estimates separated by time, and repeated estimates separated by treatment) and I'm not sure what to treat as fixed effects and what to treat as random effects, whether I have a nested structure or not, and whether I should be looking at random intercepts only or also random slopes (and for which variables).

Any help or suggestions are greatly appreciated. Thanks!


1 Answer 1


Many years late, but for completeness' sake, I will attempt to answer this.

As noted in the question, the main complication is that there is variance in the data explainable by the fact that there are multiple measurements on each individual. You can account for this with a random effect. The simplest model that you might use to address this above question (in R) is:

lmer(distance_estimate ~ condition + measurement_occasion + actual_distance +

Things to note:

1) I have assumed no interactions here but several are plausible. For example, condition and actual_distance might interact, as might condition and measurement_occasion. Which ones are included depends on your hypotheses.

2) I've also used just a random intercept here, but you might well include a random slope, or both random intercepts and slopes. Again, this will depend on your hypotheses and domain knowledge.


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.