Skip to content
Prev 19082 / 20628 Next

question regarding time as a continuous factor in a linear mixed effects model

Dear Laura,
you could use a package like "effects" or "emmeans" to compute estimated
marginal means and compare the values for time = 1 and time = 4, or you
could even use pairwise comparisons, like:

library(emmeans)
mdl.outcome <- lmer(outcome ~ time*Group + (1 | PID), data = dta)
emm <- emmeans(mdl.outcome, c("time", "group"), at = list(time = c(1, 4)))
emm
pairs(emm)

Best
Daniel

-----Urspr?ngliche Nachricht-----
Von: R-sig-mixed-models <r-sig-mixed-models-bounces at r-project.org> Im
Auftrag von Laura Coco
Gesendet: Donnerstag, 25. Februar 2021 18:36
An: r-sig-mixed-models at r-project.org
Betreff: [R-sig-ME] question regarding time as a continuous factor in a
linear mixed effects model

Hello,

I am interested in investigating the main effects of group, time, and group
by time interaction on survey outcomes using linear mixed effects models.
Time is considered as continuous (number of days since baseline), but isn't
it also categorical, since I want to compare Session 1 vs Session 4 (for
example)? How is that handled in the model? As of now, time (days since
baseline) is being treated as one unit, rather than four separate sessions.

Here is an example of my code: mdl.outcome <- lmer(outcome ~ time*Group +
(1 | PID), data = dta)

Thank you!!


_______________________________________________
R-sig-mixed-models at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

--

_____________________________________________________________________

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

SAVE PAPER - THINK BEFORE PRINTING