Hey There!
I am trying to fit a multilevel time series model to some physiological data I have from a psychological experiment. Specifically, in this experiment 36 participants completed a cognitive task, which involved 30 trials for each of 3 conditions. For each trial, I have a time series with approximately 200 time points reflecting physiological arousal throughout the trial. This means I have 36 x 30 x 3 x 200 data points (minus some missing data points) that I would like to model hierarchically as a function of condition while treating subject as a random effect. My first thought was to fit some sort of Gaussian Process – but if I even try to do that, R crashes (I suspect it runs out of RAM). I was hoping to get some advice on other, perhaps more economical Bayesian approaches to this sort of modelling problem. I have just now moved on to splines (I have a model running as we speak – but it is moving very, very slowly) using the following code:
brm(formula = y ~ condition + s(time, by = condition) + (1 | id),
data = dat,
family = gaussian(),
chains = 4,
cores = 4,
iter = 2000) -> bm1
Most of these variables should be self-explanatory, but to be clear, y is my physiological measure and id is a unique identifier denoting my participants. Any advice would be appreciated. In particular, it strikes me that this initial model assumes implicitly that all participants share the same waveform (since the smooth term varies only by condition, not id). I anticipate that the wave form itself could vary in subtle ways from subject to subject, but I am not sure how to incorporate this into the model. One step at a time!
In case it matters, I am running this on a fairly recent, upgraded MacBook Pro. I have been fitting models using Stan for a few years now without issue.
Cheers!
Jon