# [R-sig-ME] Mixed-Effects Models with Group or Covariate-Dependent Autocorrelation

Viechtbauer Wolfgang (STAT) wolfgang.viechtbauer at maastrichtuniversity.nl
Wed Dec 12 15:51:40 CET 2012

```Dear All,

I am currently working with some mixed-effects models for longitudinal data where I want to test hypotheses about the difference in the strength of the autocorrelation between two groups. In particular, let's say I have data of the form:

person  time  group  y
----------------------------
1       0     A      <value>
1       1     A      <value>
1       2     A      <value>
...     ...   ...    ...
2       0     A      <value>
2       1     A      <value>
2       2     A      <value>
...     ...   ...    ...

and I want to fit the model:

y_ij = beta_0 + beta_1 time_ij + u_0i + u_1i time + e_ij,

where i is the index for person, j is the index for time, u_0i ~ N(0, tau^2_0) is a random effect for the intercepts, u_1i ~ N(0, tau^2_1) is a random effect for the slopes, cov(u_0i, u_1i) = tau_01 is the covariance between these two random effects, and now I want to fit an AR(1) structure for the errors e_ij, where the autocorelation is rho_A for people from group A and rho_B for people from group B. In principle, I may also want to let the error variance to differ for the two groups (i.e., sigma^2_A and sigma^2_B).

In nlme, I can fit models with a common autocorrelation structure for the two groups, with:

lme(y ~ time, random = ~ time | person, correlation = corAR1(form = ~ time | person))

but as far as I can tell, it is not possible to allow the autocorrelation parameter to differ between the two groups.

Does anybody know of a package/function that would allow fitting such a model?

Moreover, the groups are actually created by dichotomizing a continuous measure. Ideally, I would like to fit a model, where rho depends on the continuous measure directly. Or, to avoid issues related to rho having to fall between -1 and 1, it would probably make more sense to assume that f(rho) depends on that continuous measure, where f() is the arctanh (inverse hyperbolic function or Fisher's r-to-z) transformation. Again, any ideas on packages/functions that may handle such a model?

Thanks in advance for any suggestions!

Best,
Wolfgang

--
Wolfgang Viechtbauer, Ph.D., Statistician
Department of Psychiatry and Psychology
School for Mental Health and Neuroscience
Faculty of Health, Medicine, and Life Sciences
Maastricht University, P.O. Box 616 (VIJV1)
6200 MD Maastricht, The Netherlands
+31 (43) 388-4170 | http://www.wvbauer.com

```