Cross Validated Asked on January 29, 2021
I am familiar with fixed-effects linear regression models, and have done reading on mixed-effects models.
I am attempting to fit a model based on observational data, where treatments come at varying times and do not exist at all for a majority of subjects.
I am interested in whether or not the treatment has an effect on the trajectory of a subject’s response over time. Graphically:
The most relevant analogous model I have found would be the one specified here, specifically Part 3. However, this example does not use R. I have read through all of Bates’ lme4 paper, but I am still uncertain how to specify this effect.
An excerpt of my data:
ID RESPONSE ID.CONST.1 ID.VAR.1 ID.VAR.2 TREATMENT_ACTIVE RESPONSE.TIME
1077415 7 41 0 5 FALSE 314
1077415 8 41 1 6 TRUE 316
1077415 9 41 10 7 TRUE 319
1077688 1 59 0 1 FALSE 313
1079475 1 85 0 1 FALSE 313
1080811 1 24 0 1 FALSE 314
1081156 1 502 0 1 FALSE 314
1082437 1 50 0 0 FALSE 315
1083154 1 257 0 0 FALSE 315
1083154 2 257 0 0 TRUE 316
1083527 1 69 0 0 FALSE 315
1086283 1 31 0 0 FALSE 316
1088810 1 120 2 1 FALSE 317
1090019 1 93 2 1 TRUE 317
1091048 1 27 0 0 FALSE 317
1091114 1 62 0 1 FALSE 317
Each subject (ID
) has time-varying measurements (ID.VAR.X
), constant measurements (ID.CONST.X
), as well as the time of observation (RESPONSE.TIME
). TREATMENT_ACTIVE
indicates whether or not the treatment is active for a given subject at the corresponding RESPONSE.TIME
. Some subjects have a single observation, others have multiple observations, and treatment times are rarely the same between subjects.
I’ve attempted to fit models as:
lmer(RESPONSE ~ ID.CONST.1 + ID.VAR.1 + ID.VAR.2 + TREATMENT_ACTIVE + RESPONSE.TIME + (1|ID) + (1|RESPONSE.TIME)
lmer(RESPONSE ~ ID.CONST.1 + ID.VAR.1 + ID.VAR.2 + RESPONSE.TIME + (1|ID) + (1+TREATMENT_ACTIVE|RESPONSE.TIME)
However, I’m fairly certain this is misspecified. I am not sure how to specify the random effects to ensure that the TREATMENT_ACTIVE
variable is interpreted as I intend. I am interested in testing both an intercept-only model as well as a intercept+slope model for the treatment effect.
It isn't clear from your description whether the intervention occurs at the same time for all individuals, or whether there is a time-dependency in the intervention. In any case, Chapters 5 and 6 of the book, Applied Longitudinal Data Analysis by Singer and Willet would seem to cover exactly what you want. In fact, you almost got to the right place with the link you included! Have a look at the R code for chapteres 5 and 6 at the website for the Singer and Willet book. Also, search for "discontinuous time".
Answered by user02814 on January 29, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP