# BBR19: Serial data

**URL:** <https://discourse.datamethods.org/t/bbr19-serial-data/3466>\
**Category:** statistical\
**Tags:** longitudinal\
**Created:** [June 11, 2020, 4:56pm UTC](https://discourse.datamethods.org/t/bbr19-serial-data/3466 "2020-06-11T16:56:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![f2harrell](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/f2harrell/32/165_2.png) [@f2harrell](https://discourse.datamethods.org/u/f2harrell)\
**Post date:** [June 11, 2020, 4:56pm UTC](https://discourse.datamethods.org/t/bbr19-serial-data/3466/1 "2020-06-11T16:56:54Z")

</div>

This is a topic for questions, answers, and discussions about session 19 of the [Biostatistics for Biomedical Research](http://hbiostat.org/bbr) web course airing on 2020-06-11. Session topics and a link to the course notes with audio narration are listed [here](https://hbiostat.org/bbr/schedule.html). The session covers analysis of serial data (longitudinal data).

---

<div class="post-metadata">

**Author:** ![mdmanurung](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/mdmanurung/32/1294_2.png) [@mdmanurung](https://discourse.datamethods.org/u/mdmanurung)\
**Post date:** [June 20, 2020, 6:25am UTC](https://discourse.datamethods.org/t/bbr19-serial-data/3466/2 "2020-06-20T06:25:48Z")

</div>

I would like to do a correlation analysis of two variables that were measured in a longitudinal study. To my understanding, the usual correlation analysis cannot be used here due to the samples being not independent. What can I do here?

Is it right to run a linear mixed model such as below (example written in _lme4_ style):

```auto
lmer(varA ~ varB + (1|subject), data = data)

```

And then calculate the intraclass correlation? Would this be a valid approach to get a repeated-measures correlation?

---

<div class="post-metadata">

**Author:** ![f2harrell](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/f2harrell/32/165_2.png) [@f2harrell](https://discourse.datamethods.org/u/f2harrell)\
**Post date:** [June 20, 2020, 10:33am UTC](https://discourse.datamethods.org/t/bbr19-serial-data/3466/3 "2020-06-20T10:33:17Z")

</div>

You’ll probably get more help from time series methods. I’m not sure if using a random effects model will be as effective as computing the per-subject Spearman or linear correlation coefficient and then treating them as raw data. Your research seems to be calling for cross-correlation analysis.
