# How do I account for temporal autocorrelation?

I am trying to fit a beta regression model using GAMLSS.

The data:

For each $y$, we have an indication of what patient $p$ it is, an indication of what month $m$ the observation took place, and at what location $l_1, l_2$ (longitude and latitude) the observation took place. We then further have covariates such as sex.

Here's an example of what the data set might look like:

y   p  m   l_1 l_2 sex
0.5 1 Jan  22  -49  M
0.7 1 Jan  25  -51  M
0.4 1 Feb  21  -52  M

0.5 2 Jan  21  -51.5  F
0.5 2 Jan  24  -51   F
0.5 2 Jan  21  -51  F
0.5 2 Feb  20  -52  F
0.5 2 Feb  21.5  -55  F


The model:

This is my question. How should I set up the model to account for autocorrelation, both temporal and spatial?

I know that I can model the longitude and latitude using a smooth function $f(l_1, l_2)$, so that the model might be

gamlss(y ~ sex + f(l_1,l_2) + random(p), family = BE)


where $p$ is a random effect for each patient, and sex is a fixed factor effect.

For temporal autocorrelation, is it enough to include it as a fixed effect?

gamlss(y ~ sex + m + f(l_1, l_2) + ranndom(p), family = BE)?

• How to account for temporal autocorrelation (or anything in your model) depends on what the goal is for the model and your assumptions about what the underlying mechanism is. So please give us some additional info on what the purpose is of your model, and what kind of temporal autocorrelation you're worried about and why it might affect your interpretation of the model. – Hao Ye Apr 28 '17 at 18:38