Autocorrelation added to the model results in outrageous computation time

Hi,
I am no expert on autoregressive models, but since nobody else responded, I will give it a try.
The thing to notice is that the AR models brms (and AFAIK more generally) do something very different from taking the observed value at previous timestep as predictor. It takes the true (unobserved, de-noised, …) value of the process at previous timestep as predictor. If you were working with normal response, this “only” makes the overall distribution a multi-variate normal with a specifically structured correlation matrix and the model only gains the AR parameter.

However, this simple math stops working once you have non-normal response distribution. So instead what brms does (and what you can inspect in the Stan code generated by brms via make_stancode is to introduce one new parameter for each observation to model the residuals (vector[N] err; in the code) and keep them correlated following the AR structure. The model than has (paraphrasing) y ~ beta_proportion(mu + err, phi) where mu is the linear predictor without the autocorrelation term.

There are many ways this can go wrong - first you just added a ton of new parameters, so the model will definitely be slower. Second (and IMHO more importantly), you now effectively have two noise parameters: one representing the standard deviation of the AR residuals (sderr) and the scale of the beta noise (phi). It is quite possible that increasing sderr has almost the same effect on the likelihood as decreasing phi and so both cannot be identified unless you observe multiple seprate time series (and non-identifiabilities wreck the sampler). You can check if this is the case by inspecting the pairs plot for the parameters and seeing if there is a negative correlation (would likely be visible even in the broken fit). Also the additional flexibility phi has due to it being predicted as well definitely does not help.

This is unfortunately one of the cases where the power of brms becomes somewhat dangerous - brms does a lot of magic behind the scenes and it is very easy to specify a model that has serious problems.

Does that make sense?

Best of luck with your model!

EDIT: you are more likely to get help with brms using the brms category and note that you can use ``` (triple backticks) to mark code blocks. I edited and recategorized the post for you.

4 Likes