I have a dataset where I need to test whether there are significant differences between GroupA and GroupB.

GroupA and GroupB contain values obtained from an experiment that was repeated over 3 days (Day = 1, 2, 3). Measurements are obtained over 6 hours for each of the 3 days starting at 0 (Hour = 0, 1, 2, 3, 4, 5, 6). Since the data for the experiment are obtained hourly, the data within each group are not independent of each other.

I am not sure how to test for a significant difference if the values within a group are not independent. Any guidance will be greatly appreciated.

  • 1
    $\begingroup$ Given that you have gone to the bother of making timed measurements I would suppose that you are at least interested in some sort of time-dependence. Do not think that a 'significance test' is the full extent of a proper analysis of your data and do not take advice from anyone who does not first ask for plots of the data. $\endgroup$ Commented Oct 28, 2022 at 20:40

1 Answer 1


Assuming the measurements are continuous and reasonably normal, one way to address your question is by means of a linear mixed model. This will include a dummy for the group, a random intercept for the statistical unit and a random intercept for day within each unit.

In R this can be done by the following command

mod_lme <- lme(resp ~ group, random = ~ 1 | unit_id/day, 
               data = mydata)

To assess the difference between the two groups, just look at the confidence interval of the parameter associated with the variable group.


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.