I'm hoping for some advice. I have a longitudinal dataset with two variables, measured 3-5 times per individual (so 3-5 timepoints per subject). Both variables are measured on the same day, but the time between timepoints is variable between individuals, and between visits within an individual.

This dataset also contains related samples (twins), so there is family structure in addition to the multiple measurements per individual.

We are interested in assessing how the relationship between the two variables changes over time.

I would be very grateful for advice on models that could address this question. I am an R user, and from my reading I have come across suggestions of autoregressive linear mixed effects models with visit as a random effect, but am unsure how exactly to code such a model.

I would really appreciate any advice you could offer on appropriate models.

Thank you in advance!


1 Answer 1


Given what you wrote, I would use a multivariate mixed effects model with two levels of random effects.

The simplest model would have a slope and intercept.

Subject id is nested within twin id. There is variability between twins and variability within twins.

There are two packages I have seen on cran to fit multivariate mixed effects models.

First, MMeM. Unfortunately, it says "Currently, it only supports multivariate mixed effects model with one fixed effects and one random effects and two response variates".
You have two response variates, but you need more than one fixed effect and more than one random effect. Also, you want two levels of random effects, which this doesn't allow.

The second package is MCMCglmm. See this vignette. It says "More than one response variable can be analysed simultaneously, and these variables are allowed to follow Gaussian, Poisson, multi(bi)nominal, exponential, zero-inflated and censored distributions. A range of variance structures are permitted for the random effects, including interactions with categorical or continuous variables (i.e., random regression), and more complicated variance structures that arise through shared ancestry, either through a pedigree or through a phylogeny".

Also, see this previous question here and the answer points to this which has an example using MCMCglmm.


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.