5
$\begingroup$

I’m working with time series data. Several variables among subjects are measured at intervals of two weeks over 1.5 years. The main goal is to estimate associations between different variables.

Consider a mixed model with AR(1) autocorrelation. In my sample, time points for measurements are irregular, so the spherical correlation between ordered observations in time may be imprecise. Alternately there is a random coefficient model. How does a random effect structure handle correlation between observations? If the autocorrelation between measurements within subject is constant no matter how far apart in time the measurements are, the model is not an option for me.

$\endgroup$
4
  • 2
    $\begingroup$ "But I cant se how the autocorrelation is taking care of just because intercept are a random effect within subjects" - because it doesn't. $\endgroup$
    – Tim
    Commented Feb 19, 2016 at 7:51
  • $\begingroup$ See my suggested edits. Also, when you say your time series is irregular, do you mean you have measured $(X_1, Y_1), (X_2, Y_2), \ldots$ synchronously or you might have $X_s, Y_t$ where the indices $s$ and $t$ may or may not overlap? $\endgroup$
    – AdamO
    Commented Jan 2 at 15:28
  • $\begingroup$ Secondly, and it should be obvious, what is the nature of the relationship you're trying to estimate between two variables? There's more than one - most people consider cross-sectional relationships in this case. But there could be a lagged association, or a number of other things which could be called "trends". $\endgroup$
    – AdamO
    Commented Jan 2 at 15:29
  • $\begingroup$ @Tim Indeed, but perhaps you could speak to the idea of including time as a random slope? $\endgroup$
    – AdamO
    Commented Jan 2 at 15:30

4 Answers 4

6
$\begingroup$

The question is,

How does a random effect structure handle correlation between observations?

The answer is revealed by analysing a simple example of the model you describe. It turns out the correlation does not depend on the time interval and therefore is unlikely to be appropriate in your application.


Consider a numeric response $Y$ for subject $j$ (with characteristics $\mathbf x_{j} = (x_{j1},x_{j2}, \ldots, x_{jp})$) at time $t_i.$ Model this as a sum of

  • fixed effects $\mathbf x_j\beta$ (for a constant but unknown parameter vector $\beta = (\beta_1,\beta_2,\ldots,\beta_p)^\prime)$),

  • a random effect $U_j$ varying among subjects, and

  • independent "error" $\varepsilon_{ij}$ associated with each observation of the response.

In mathematical notation this can be expressed as

$$Y_{ij} = \mathbf x_{j}\beta + U_j + \varepsilon_{ij}.$$

Standard assumptions are that all the random variables are uncorrelated and have constant variances and means so that (say)

$$\operatorname{Var}(U_j) = \tau^2$$

and

$$\operatorname{Var}(\varepsilon_{ij}) = \sigma^2.$$

(With no loss of generality, all means can be absorbed as an "intercept" in the fixed effect and thereby taken to be zero.)

Focus on a specific subject and compute the correlation among any two of its observations $(Y_{1j}, Y_{2j}, \ldots, Y_{nj})$ (which, with no loss of generality, we may take to be the first two). A standard formula uses the variance-covariance matrix, so let's begin there.

$$\operatorname{Var}(Y_{ij}) = \operatorname{Var}(\mathbf x_j \beta + U_j + \varepsilon_{ij}) = \tau^2 + \sigma^2$$

(because $U_j$ is assumed uncorrelated with $\varepsilon_{ij}$) and

$$\operatorname{Cov}(Y_{1j}, Y_{2j}) = \operatorname{Cov}(\mathbf x_j \beta + U_j + \varepsilon_{1j},\ \mathbf x_j \beta + U_j + \varepsilon_{2j}) = \tau^2$$

(because $U_j,$ $\varepsilon_{1j},$ and $\varepsilon_{2j}$ are uncorrelated).

Consequently the correlation between any two pairs of observations of the same subject is

$$\rho_j = \operatorname{Cor}(Y_{1j}, Y_{2j}) = \frac{\operatorname{Cov}(Y_{1j},Y_{2j})}{\sqrt{\operatorname{Var}(Y_{1j})\operatorname{Var}(Y_{2j})}} = \frac{\tau^2}{\tau^2 + \sigma^2}.$$

This does not depend on the time interval $\tau_2 - \tau_1$ and therefore does not depend on any time interval.

Notice, too, that this model implies strictly positive correlations among the observations of any given subject. Intuitively, this arises from the common (but random) influence $U_j$ pertaining to subject $j.$

$\endgroup$
2
  • $\begingroup$ Sorry to bring up an old(ish) answer, but I am slightly puzzled by it. It seems that the model you are working with is one with a random structure that has intercepts varying by subject. I agree that this leads to compound symmetric residual covariance structure where the correlations between observations do not depend on the time intervals. However, I think the question is about (additionally) having a random coefficient/slope, and it's that which is supposed to "take care of autocorrelation". $\endgroup$ Commented Jun 18 at 11:19
  • $\begingroup$ @Robert I agree that a "random coefficient model" could generalize from random intercepts to random coefficients $\beta_j,$ but I don't see what would be puzzling about that -- it looks like the same analysis would apply, albeit with more complicated results. $\endgroup$
    – whuber
    Commented Jun 18 at 14:18
4
$\begingroup$
  1. You could just ignore this problem. You can show through simulation that, with some extreme exceptions, an approximate but not exact answer to the variance covariance structure usually leads to reasonable estimation. You can safeguard this approach even more by using a generalized estimating equation (GEE) model.
  2. If AR1 is the right model, treat the unmeasured time series observations as missing data and impute them. If your X, Y processes are asynchronous, it could be as simple as LOCF. Otherwise, multiple imputation could be used. Alternately, you can edit the generalized least squares fitting process to account for imbalanced design and populate the variance-covariance matrix according to the observed design.
  3. Random effects models contain random intercepts or random slopes. In your example, including time as a random slope nested in subject induces a spherical-type correlation between adjacent observations. As always, fit a variogram to inspect the shape and nature of the temporal correlation.
$\endgroup$
0
$\begingroup$

Would be the MMRM model an option for you? It is a flavour of mixed models. If you are only interested in the fixed effects and just want to account for the random effects you could define your fixed effects, "shovel" your random effects in the error part of the function and set the covariance structure to 'unstructured'. This could work as long you are not interessted in the random effects and you have enough data.

I hope I could help somewhat.

$\endgroup$
1
  • $\begingroup$ Thanks RGG. Unfortunately I have not enough data. I've tried that option. And also I have clumps of zero in my data so I'm planning to use SAS nlmixed which don't have the option of R-side random effects. $\endgroup$
    – Petter
    Commented Feb 19, 2016 at 9:52
0
$\begingroup$

You could use glm in combination with the corCAR1 correlation structure from the nlme package in R. This is for continuous irregular time measurements as you have. Although this is not exactly an answer to your question, because you do not have/need a random effect in gls models.

To answer your question, you could use a random linear (or quadratic,cubic, ...) slope of "week". With a random linear slope, you e.g. model a quadratic pattern in the variances over the weeks. And also a particular pattern for the correlations between any pair of weeks you select. E.g. Singer and Willet show the formula's in their book Applied Longitudinal Data Analysis: Modeling Change and Event Occurrence.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.