Autocorrelation for unevenly spaced time series

Please also provide the following information in addition to your question:
I used this autocorrelation cor_ar structure for my time series data. However, I think it is more meant for evenly spaced data, while my data, as well as many other data, are more likely to be unevenly spaced, I believe. Will brms consider implement an autocorrelation structure for unevenly spaced time series data? Although most of my models included autocorrelation (cor_ar) were better than those not included when judged by loo_compare.

Should the random effect and autocorrelation have the same structure? In a model, where I used the same structure for random effect and autocorrelation, and I used re_formula = NA in function fitted to not to include those random effects. However, my predicted lines looked awkward, they were jagged. Can someone tell me what is wrong?

I also found that lines fitted with brms are more wiggly than those fitted with gamm from package mgcv, why is that?

  • Operating System: 64-bit
  • brms Version:2.9.0

With you first question you are refering to continuous time autoregressive models. This might get implemented at some point in brms, but is likely far away in the future (if it will ever come). You may want to look at the ctsem R package which handles continuous time models and can also use Stan as backend,

It is often plausible to assume the random effects and the autocorrelation to have the same structure. For instance, the lme function of the nlme package even has checks that this is indeed the case. However, there is no general answer and it will depend on the specific structure of your data.

I can’t tell why the brms lines were more wiggly than those of mgcv but this may very well happen. After all, we are using a complete different approach to estimate these models.

1 Like

If you are using mgcv, then you can use the correlation structure corCAR1 in the gamm function. One of the few things I miss in brms.

I think the OP was thinking of a continuous-time analogue of the cor_ar() correlation structure rather than an entire continuous-time model.

An example would be be nlme::corCAR1(), which is a special case of an exponential spatial correlation structure.

Pinheiro & Bates (2000; Mixed-Effects Models in S and S-PLUS) give the CAR(1) as:

h(s, \phi) = \phi^s, \; s \geq 0, \; \phi \geq 0

where s is the separation in time between any pair of samples.

I haven’t looked in detail at the implementation in nlme, but it does seem to be a generalisation of corAR1() to non-integer time intervals, with the exception that \phi is constrained to be non-negative.

Having such a structure in brms would be very useful for a range of longitudinal models where we can’t assume that the observations are at regularly-spaced intervals.

1 Like

Yeah that makes sense. Would you mind opening an issue about this on github so that I don’t forget about this feature?

1 Like

Thanks Paul. Will do this afternoon.

For reference, I opened this as issue #741