Skip to content

About modelling time as continuous variable in a glmmTMB-based model.

3 messages · Julian Gaviria Lopez, Daniel Lüdecke

#
Dear lists members,

Based on the glmmTMB-based model:

Model 1. Time as a fixed factor:
zipoisson <- glmmTMB(Observations ~ CAP * Time + (1|ID), data=mDATA, ziformula=~ CAP * Time , family=poisson)

A gentle member from this list suggested me to treat time as continuous.  Since I am new with mixed models, I would like to confirm that the new models for this aim are right:

Model 2. Time as continuous variable:
zipoisson <- glmmTMB(Observations ~ CAP * Time + (ID|Time), data=mDATA, ziformula=~ CAP * Time, family=poisson)

Model 3.  Time as continuous, with the dispersion parameter identical for each observation:
zipoisson <- glmmTMB(Observations ~ CAP + (ID|Time), data=mDATA, ziformula=~ 1, family=poisson)


It calls my attention that models 1 and 2 yield the same results. In this way, I wonder whether I did model time properly. Maybe I should introduce the levels of "Time" differently?

current arranging of time data:
Time
  m1
  m2
  m3

Alternative option?
TIme
   1
   2
   3


I thank you in advance for any comment in this regard.

Best regards,


Julian Gaviria
Neurology and Imaging of cognition lab (Labnic)
University of Geneva. Campus Biotech.
9 Chemin des Mines, 1202 Geneva, CH
Tel: +41 22 379 0380
Email: Julian.GaviriaLopez at unige.ch
#
Dear Julian,
typically, time varies across groups, so you should model time as random
slope (i.e. switch time and ID in the random effects):

glmmTMB(Observations ~ CAP * Time + (Time | ID), data=mDATA, ziformula=~
CAP * Time, family=poisson)

Best
Daniel


Julian Gaviria Lopez <Julian.GaviriaLopez at unige.ch> schrieb am Di., 16.
Juli 2019, 17:25:
--

_____________________________________________________________________

Universit?tsklinikum Hamburg-Eppendorf; K?rperschaft des ?ffentlichen Rechts; Gerichtsstand: Hamburg | www.uke.de
Vorstandsmitglieder: Prof. Dr. Burkhard G?ke (Vorsitzender), Prof. Dr. Dr. Uwe Koch-Gromus, Joachim Pr?l?, Marya Verdel
_____________________________________________________________________

SAVE PAPER - THINK BEFORE PRINTING
#
Dear Daniel,


Thank you so much for your message. Maybe a brief contextualization might provide a clearer idea about my aims :


Conext:
Data from  50 individuals (ID) encompass 4 brain components (CAP) collected during 2 different conditions. Each condition lasted 5 minutes (split in 1-minute bins: m1, m2, ,m3, m4, m5). The data is arranged like this:

ID
Observations
  CAP
Time
1               3          C1    m1
1               0          C1    m2
1               2          C1    m3
1               0          C1    m4
1               1          C1    m5
?       ?       ?       ?
50              0          C1    m1
?       ?       ?        ?


                 50                                           0              C4       m5
Aim:
Based on the analysis of variance, I aim to find statistical interactions among the CAPs over time (m1... m5). Simultaneously, I want to identify whether any CAP is a better predictor of such variance, for a specific condition. For this reason, I opted for modelling the conditions in two different models.

Model:
zipoisson <- glmmTMB(Observations ~ CAP * Time + (1 | ID), data= mDATA, ziformula=~ CAP * Time , family=poisson)

According to my aims, I do not think that time should be modeled as random slope, but I really would like to hear you opinion (or the one from any other kind expert from the list) after understanding the context of my question.

P.D.  I did run the model as  random slope, such as you suggested, and I deleted the "m" from the "Time" variable,
zipoisson <- glmmTMB(Observations ~ CAP * Time + (Time | ID), data= mDATA, ziformula=~ CAP * Time, family=poisson)

Strikingly, the model did not converge for one of the conditions.


Thanks in advance and best regards.

Julian Gaviria
Neurology and Imaging of cognition lab (Labnic)
University of Geneva. Campus Biotech.
9 Chemin des Mines, 1202 Geneva, CH
Tel: +41 22 379 0380
Email: Julian.GaviriaLopez at unige.ch