Advice on hierarchical or non-hierarchical model

I can’t decide between two ways to specify my model: I have 1 participant who completed say 100 behavioural measurements, in the beginning and then every 10 measurements, we would ask them to rate their mood.

Should my model be

behaviour ~ 1 + mood


behaviour ~ 1+ mood + (1+mood| block_of_10_trials)

I’m unsure what to do because even though we have 100 unique behavioural measurements, there are only 10 unique mood measurements that I have then expanded (i.e. the 10 behavioural measurements following a mood rating all have the same mood rating attached)

Yet another alternative would be:

behaviour_average_every_10_ measurements ~ 1+ mood

So here then, my design matrix would only have 10 rows.

I’d be very grateful for any thoughts on this.

1 Like

Your second specification will not work, because it asks how the effect of mood varies across blocks, but there’s no information to estimate a within-block effect of mood because there’s no within-block variation in mood.

Your first possibility might be a good model for your data. It could be improved if any of the following is true:

  1. the mood measurement induces some stochastic change in behavior when it happens, so that behavior changes stochastically across trials in a “blocked” manner.
  2. the relationship between behavior and mood isn’t perfectly linear, so that the expected residual differs by block
  3. behavior changes across trials for a reason unrelated to mood and unrelated to the blocking induced by the mood measurement.

These possibilities suggest some additional models. 1 & 2 would both suggest a model like
behaviour ~ 1 + mood + (1 | block_of_10_trials)

Possibility 3 would suggest a model like
behavior ~ 1 + mood + measurement_index (linear relationship with measurement_index) or
behavior ~ 1 + mood + s(measurement_index)

These could also be combined, though it might be flogging your data a bit hard to include both the random effect and the smooth term above. But
behavior ~ 1 + mood + measurement_index + (1 | block_of_10_trials)
feels like it might be reasonable, if something like this is consistent with your domain expertise.


Thank you for explaining this in detail, this is extremely helpful! I need to think some more about how to include this.

I think I have already included something that is a bit like your suggestions with:

behavior ~ 1 + mood + measurement_index

by doing

[1] behaviour ~ 1+ measurement index
-> get the residual
[2] residual ~ mood

the reason i’ve been doing it like this is that I’m not sure yet how to best code mood - they rate different emotions and they could be combined in different ways. So I was thinking that the two step process is overall faster (and then maybe once I have results I will rerun something like what you suggest to be sure it’s not an artefact of this approach)