I'm using linear mixed model with the lme4 package in R to analyze EEG amplitude in two different subject groups (control & experiment).
All subjects were instructed to view images of two different categories (car vs human). While category 1 solely comprises of whole cars, category 2 can then be divided into three sub-categories (head, trunk, extremities).
My dataset looks like this:
Amplitude | Group | Category | Sub-category | Subject |
---|---|---|---|---|
13.231 | control | car | car | 1 |
12.123 | control | car | car | 1 |
11.876 | control | human | head | 1 |
18.423 | control | human | trunk | 1 |
14.132 | control | human | extr | 1 |
13.231 | exper | car | car | 2 |
12.123 | exper | car | car | 2 |
11.876 | exper | human | head | 2 |
18.423 | exper | human | trunk | 2 |
14.132 | exper | human | extr | 2 |
13.412 | exper | car | car | 3 |
12.534 | exper | car | car | 3 |
19.233 | exper | human | head | 3 |
15.423 | exper | human | trunk | 3 |
17.122 | exper | human | extr | 3 |
... | ... | ... | ... | ... |
Now I am interested in the effect of group, category, as well as sub-category on EEG amplitude. I am also interested in the interaction between group and category, and group and sub-category.
Hence, I would like to define category and sub-category as fixed effects. My current model looks like this:
AMP.model = lmer(amplitude ~ group * (category + subcategory) + (1|patient), data=AMP)
But then i receive the following warning:
fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
I believe this is due to the assumption in linear mixed models that fixed effects should not be correlated / nested. But how else would I get the information that I am interested in?
Please note that it is not an option to remove the categories and only check for sub-categories, as my main hypothesis is based on the effects of categories on EEG amplitude.
amplitude ~ group * category + group:category:subcategory + (1|patient)
I don't think you need to set up special model contrasts, and the emmeans package will detect the nested structure and provide for sensible means and comparisons. $\endgroup$