This question is related to an earlier one that I've posted (but I must admit, that I was very unspecific in this thread, so I am making an effort to be more explicit here). I have a dataset that contains a nested structure, which I want to address with a mixed model to test my hypothesis. For each subject in this data set, I have data for 376 brain regions, and for each brain region I have activation values for 12 transitions that each of the brain regions "go through". I am interested in finding out if they are differences in values between brain regions across all subjects and across all transitions (Note: The order of the transitions does not matter but should be treated as a categorical variable). I have a first intuition of what I want, but I struggle with the translation of my problem into a formal mathematical model that can handle this problem. Here are a few thoughts in plain English that sum up this first intuition:
I "don't care" about subject differences, in other words, I could also just average all subjects and look at the average subject or treat every subject as a random draw from a distribution. Same with the transitions: I don't care about differences between transitions. Rather I am interested if regions differ on average across transitions. Every region belongs to a subject and therefore it is nested within that subject (nested fixed effect?). Similarly, for each region within each subject, I have data from 12 transitions. Here I am a little bit unsure how to model this, as a nested or a crossed random effect?
Answers that contain a formula for lmer
or statsmodels
would be greatly appreciated!
Here's a toy example for how my data frame looks like: