I have a research question and am unsure about the linear mixed effects model in Matlab.
The data are firing rates of neurons during trials of an experiment (firing_rate
, averages per recording session, see below).
Subjects perform a task and their response during each trial is either correct or incorrect. This binary variable is the predictor (is_correct
). There are two data points per recording session, namely the firing rate across all correct and across all incorrect trials.
Each neuron is associated with an experimental session and each experimental session (sessID
, categorical) is associated with a subject (subjID
, categorical). Each subject completed between one and six sessions. Each neuron is also located in one of 4 different brain regions (region
, categorical).
Now, I would like use fitlme in Matlab to set up a model where
- Subjects can have individual slopes and intercepts
- Sessions (nested in subjects) can have individual slopes and intercepts. However I'm not sure if I should actually leave this one in
- Brain regions can have individual slopes and intercepts
Here's what I've come up with. What still confuses me is that sometimes random intercepts are implicitly included. I don't find the notation intuitive
This is my attempt
fitlme(ds, 'firing_rate ~ is_corr + (is_corr | subjID) + (is_corr | subjID:sessID) + (is_corr | region)')
Does this match my description above? I'm not sure if there is maybe a "1 +" missing.
If my output was numerically close to this (i slightly changed most values due to confidentiality):
Linear mixed-effects model fit by ML
...
Fixed effects coefficients (95% CIs):
Name Estimate SE tStat DF pValue Lower Upper
{'(Intercept)'} 0.04 0.017 2.341 6980 0.005208 0.01456 0.068447
{'is_corr_1'} -0.0014 0.0081 -0.151 6980 0.97209 -0.015213 0.01387
Random effects covariance parameters (95% CIs):
Group: subjID (15 Levels)
Name1 Name2 Type Estimate Lower Upper
{'(Intercept)'} {'(Intercept)'} {'std' } 5.84568e-8 NaN NaN
{'is_corr_1'} {'(Intercept)'} {'corr'} -0.2848 NaN NaN
{'is_corr_1'} {'is_corr_1'} {'std' } 4.2836e-8 NaN NaN
Group: subjID:sessID (39 Levels)
Name1 Name2 Type Estimate Lower Upper
{'(Intercept)'} {'(Intercept)'} {'std' } 0.03869 0.029724 0.054882
{'is_corr_1'} {'(Intercept)'} {'corr'} 1 NaN NaN
{'is_corr_1'} {'is_corr_1'} {'std' } 0.0019652 1.5394e-05 0.42981
Group: region (4 Levels)
Name1 Name2 Type Estimate Lower Upper
{'(Intercept)'} {'(Intercept)'} {'std' } 0.031831 0.014867 0.05943
{'is_corr_1'} {'(Intercept)'} {'corr'} -1 NaN NaN
{'is_corr_1'} {'is_corr_1'} {'std' } 0.00089679 NaN NaN
Group: Error
Name Estimate Lower Upper
{'Res Std'} 0.27949 0.2465 0.25492
I would conclude that
the output variable firing_rate was overall not dependent on whether the response was correct (high p value, slope close to zero, lower and upper include zero. This is the main effect of firing_rate)
subjID: What do I look for here? the last estimate, i.e. the standard deviation of the random slopes of the effect of is_corr for the grouping factor subjID? It is very small and thus there is no difference between subjects? This does not seem intuitive to me because if there was no systematic effect, wouldn't the slopes be all over the place with a large std?
I guess the last 2 Effects would be interpreted in the same way and the outputs look similar.