I am doing an analysis with 2 groups of patients (control and disease) whose blood pressures have been measured continuously for 24 hours. My first goal is to test the effect of
BP. In the beginning, I built the mixed effect model with
TIME as random effect variable and group as fixed effect model. The model I used is listed below:
mod <- lme(BP ~ factor(GROUP), random=~1+ TIME| ID, data=gdata)
However, the experimenter wants to know the effects of
GROUP on the slope of blood pressure changing per hour. In another words, we need to have blood pressure slope, which is the change of blood pressure by time, as response variable in the model. And I generated another model as bellow:
mod <- lme(BP ~ factor(GROUP)*TIME, random=~1+ TIME| ID , data=gdata)
However, in the new model, the time works both as random effect variable and fixed effect variable. I am not sure if this is allowed in the mixed effect model.