MATLAB: Mixed effects model with (lagged) autocorrelation or similar

anovaarimaarimaxautocorautocorrelationautoregressionlagged autocorrela...lagged autocorrelationlagged autocovariancelinear mixedlinear mixed modellinear mixed modelsmixed modelmixed modelsmodellingnonlinear mondelrandom effectrandom factor

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.
Any advice is greatly appreciated!
Best, Paul

Best Answer

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.