Hello,
I am working with some longitudinal data resulted from a clinical trial. I have the interaction effect of time and group + random effect of Subject. Time variable consists of 6 timepoint and group has treatment and control.
First, in order to be able to see the change from one timepoint to another, I created a factor version of the time and group variables, and fitted the model as following:
lmer("Depression~Time_factor*group_factor+(1| Subject)"), data=data)
I would be ok with this, but the output gives a single intercept for both groups, which is just the mean for treatment group at timepoint 1, and a beta for each timepoint per group
which is basically the difference between the intercept and a certain group. For example, the mean for timepoint 1 control group is expreced as a beta, or the difference between the mean of treatment group timepoint 1 and control group timepoint 1.
Another option was to fit a separate model for each group with the function by.
by(data=data, INDICES=data$Group, FUN=lmer,
formula=formula("Depression~Time_factor+(1|Subject)"))
Both seem to give appropriate information regarding within-group change, but I am not sure which one to use, and which one is the correct one.
Thank you for your answers. I hope I explained everything clear enough.
Have a nice day.