My data comes from subjects performing the same task under different conditions—in other words, I have data from each subject under both the control condition and the experimental condition. This seems like a good place to use a paired-sample t-test.

However, each subject also performed the task 32 times (16 under one condition, 16 under the other).

Is there a good way to modify the paired-sample t-test to include multiple measurements of each subject, rather than just one? I know I could just take the mean of the measurements and perform the t-test on that, but that would be completely ignoring the variance within each subject.

  • $\begingroup$ In R, you can use the t.test.cluster function in the Hmisc package for this purpose, and enter participant ID as "cluster" argument of the function. Not sure about other software. You might also want to consider using a multilevel regression, in which you could regress your outcome on group and include random intercept of participant, which takes care of the data being clustered within participants. $\endgroup$
    – Sointu
    Jan 6, 2023 at 14:25
  • $\begingroup$ You could also use a mixed model. Consider to add tags mixed-model or multilevel-analysis. Also look here in the side-panel, where there is a section Related. Some of those posts might interest you! $\endgroup$ Jan 9, 2023 at 18:43

1 Answer 1


You could use a mixed model, with random effects for each subject. In R something like

mod <- lmer( response ~ condition + (1 | Subject)

where condition is a factor with levels experimental and control.


Your Answer

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

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