Data and background of the study:
The data is a repeat measurement of metabolite levels in responses to 2 types of stimuli.
The data measured in 4 sessions— sess1, sess2, sess3, sess4.
Sess1 and sess3 are the baseline blocks of no stimuli, so one level of possible stimulus type- rest, while sess2, sess4 blocks are blocks with stimuli presentation that has two possible types of stimulus presentation (A/B).
The snippet of the data as the following:
ID session stim metabolite time
1 sess1 rest 0.072 1
1 sess1 rest 0.073 2
1 sess2 A 0.084 3
1 sess2 B 0.092 4
1 sess3 rest 0.068 5
1 sess3 rest 0.071 6
1 sess4 A 0.75 7
1 sess4 B 0.069 8
2 sess1 rest 0.072 1
2 sess1 rest 0.073 2
2 sess2 A 0.084 3
2 sess2 B 0.092 4
2 sess3 rest 0.068 5
2 sess3 rest 0.071 6
2 sess4 A 0.75 7
2 sess4 B 0.069 8
...
I’m interested in how the session of measurement and stimulus type affect metabolite level. And here’s the proposed model:
mod1 <- lmer(metabolite ~ session * time + stim*time + (1 | ID),
data = df, REML=FALSE)
And of course, for mod1 I got a warning of: fixed-effect model matrix is rank deficient so dropping 6 columns / coefficients, with the only interaction between A*time but not any others. Here I suspected it to be due to the sess1 and sess3 having only one level that is not in any other sessions.
So, I drop the interaction term to:
mod2 <- lmer(metabolite ~ session * time + stim + (1 | ID), data = df, REML=FALSE)
But I still got a warning: fixed-effect model matrix is rank deficient so dropping 1 column / coefficient, with the only interaction between A*time showed in summary(mod2) but not any others.
So my questions are:
- What causes the rank deficiency here, is it because not enough information to estimate the specified model, or because REST stim is not coded in any other sessions, or both?
- What I can do to deal with the rank deficiency, should I simply drop the baseline sess1 and sess3 to look for the stimulus effect? It'd be preferable to include all sessions since I'm interested in whether the metabolite levels will change without any stimulus as well (sess1/sess3).
Apologies if this has been asked elsewhere; any help or pointers would be much appreciated!