I am new to mixed models and have been trying to teach myself how to utilize them in particular to process a repeated measures design [sample data and code presented below].
In brief, I have N=11 subjects, three manipulation groups [balanced w/ each subject participating in each], and a sleep measurement [dependent variable] taken hourly for six hours per manipulation. Ultimately, I have multiple observations per subject and per period. Sample below for visualization.
I believe to accurately utilize mixed models I must account for the correlation within subject across manipulation and within the periods, but I am not sure if that’s 100% correct and how to do that. Admittedly, I am also new to R which I am using to do this.
As I understand w/o taking in these correlations it would look like this:
lmer(Measurement ~ Manipulation + Hour + (1|Subject))
And taking into account these correlations, if that is what is supposed to be done, would look something like this, but not entirely sure it’s correct:
lmer(Measurement ~ Manipulation + Hour + (1|Subject) + Manipulation*Hour + Treatment*Subject + Subject*Hour + Treatment*Subject*Hour)
Any help is greatly appreciated!