Does this look okay?
Based on your description, and given your research question of estimating the effect of experimental_condition
, while accounting for the non-independence of observations due to the random structure your experiment has, this does not look OK to me. The issue is with the random structure, and how to handle the day
variable.
It appears that each and every subject belongs to one and only one group. Thus, subjects are nested within groups, so you need the term:
... + (1 | group_id / subject_id) + ...
which will fit random intercepts for each group and each subject within a group.
This leaves the question of how to treat the day
variable: fixed or random. There isn't necessarily a black and white answer to this, but see the list of threads at the end of my answer for help on how to choose. The first thing to note is that day
has only 4 levels. This isn't necessarily a problem if day
is nested within group_id
, since there will then be $n_{day} \times n_{group} = 44$ intercepts.
So, if treating day
as random and nested within group
we would have:
response_time ~ experimental_condition + (1|group_id/subject_id) + (1|group_id/day)
which expands to
response_time ~ experimental_condition + (1|group_id) + (1|group_id:subject_id) + (1|group_id)+ (1|group_id:day)
which then simplifies to:
response_time ~ experimental_condition + (1|group_id) + (1|group_id:subject_id) + (1|group_id:day)
Alternatively if day
is not nested within group
we wouldn't fit random intercepts with only 4 levels, so treating day
as fixed would make more sense in that scenario:
response_time ~ experimental_condition + day + (1|group_id/subject_id)
In the this latter model you should consider whether to fit an interaction term in the fixed part if the effect of the experimental condition differs by day:
response_time ~ experimental_condition * day + (1|group_id/subject_id)
And under which (hypothetical) circumstances would one nest experimental_condition within day?
Nesting experimental_condition
within day
makes sense if each experimental_condition
belongs to one and only one day
. That does not seem to be the case with your design. This would also bring up the problem of whether to fit a factor as random or variable. See the following threads for much discussion on that topic:
What is the difference between fixed effect, random effect and mixed effect models?
How to determine random effects in mixed model
Understanding Random Effects in Linear Mixed Models
Can a variable be included in a mixed model as a fixed effect and as a random effect at the same time?
Choosing Random Effects to Include in a Linear Mixed Model
experimental_condition
, while accounting for the non-independence of observations due to the random structure your experiment has. Please confirm or provide further detail. $\endgroup$experimental condition
onresponse_time
. Sorry for the omission. $\endgroup$(1 | group_id/day)
which implies thatday
is nested withingroup_id
. This means that eachday
is unique within agroup
but not across groups so for example, day 1 for group 1 is different from day 1 for group 2). Is that the case ? $\endgroup$