# Mixed effects model with (lagged) autocorrelation or similar?

26 views (last 30 days)
Paul on 16 Sep 2018
Commented: Paul on 21 Dec 2018
Dear fellow Matlab users,
Recently I have made good use of Matlab's built-in functions for making linear mixed effects. Currently I am trying to model time-series data (neuronal activity) from cognitive experiments with the fitlme() function using two continuous fixed effects (linear speed and acceleration) and several, hierarchically nested categorical random factors (subject identity, experimental session and binned linear location).
I have tried several variations of the following basic formula: 'Activity ~ Speed*Acceleration + (1|Animal) + (1|Recording session) + (Speed*Acceleration|Location)'
To cut a long story short, I have the impression that the temporal dependencies in this kind of time-series require a method capable of taking into account (lagged) autocorrelations in the data. The relative differences in the amounts of variance explained by models using different combinations of correlated/uncorrelated, interacting/independent random effects, follow my predictions, but the total amount of variance explained is never more than 1.5%.
I have been trying to find a way to model time-series data with Matlab while also taking into account the influence of the random factors. I find the explanations on the Mathworks website on this topic relate mostly to financial analysis. Those articles provide few examples and I'm having trouble translating the information in those articles to the specifics of my problem.
I was wondering if anyone could point me in the right direction.
Specifically I'm looking for a method to determine the size and significance of an effect of speed and/or acceleration on neural activity, taking into account significant inter-subject variability from a design with limited number of subjects but a large amount of data per subject.
Best, Paul

Paul on 19 Sep 2018
Ok so I figured something out myself that works reasonably well.
I simply add history terms as fixed effects. I add three fixed effects, the first being the activity one temporal bin earlier, the second being the activity two temporal bins earlier etc. This leads to a model explaining about 81% of the variance which I think is very reasonable. Thank you all for your attention.

Simone Di Plinio on 21 Dec 2018
Dear Paul,
I'm having the same approach, with a similar aim. Two questions.
1) When you say "I add three fixed effects, the first being the activity one temporal bin [...]" With 'fixed effects' you mean 'continuous variables', right?
2) In order to choose the maximum order of autocorrelation, did you check a random number of timepoints? I think it would be reasonable to test multiple models (e.g., first model -> only one timepoint earlier, second model -> one+two timepoints earlier, ...) and then compare them using likelihood or other valid criteria. Do you Agree?
Simone
Paul on 21 Dec 2018
Hi Simone,
1) Yes, but it is a bit more specific. In linear mixed effect models (or mixed models for short) there are two broad classes of predictor variables; fixed and random. Fixed effects are continuous variables where I expect a systematic relationship/correlation with the current firing rate, regardless of which subject or recording electrode the measurement was taken from. If you would like more info let met know, there's some good tutorials around.
2) Yes, I found that adding a 4th term did not lead to enough extra explained variance than a model with 3 terms to warrant inclusion. But the difference between 2 and 3 terms was higher so that's why I settled on 3 terms.