(UPDATED) I wonder if someone could advise on the correct model to be used ot analyse the longitudinal data defined as datafrane, DF, as follows:
- ID: subject ID
- SEX: categorical covariate, M/F
- TRT: categorical covariate representing drug treatment, A, B, C or D
- TIME: time of the measurement of each covariate and ENDPOINT
- ENDPOINT: response variable
- AGE: age of subjects, constant covariate
- BW: body weight, constant covariate
- HT: body height, constant covariate
- BIOMERKER1: time varying biomarker 1
- BIOMERKER2: time varying biomarker 2
BIOMARKERS1/2 are measured along with ENDPOINT and recorded at TIME points.
The model should answer the question whether any and/or which of the constant covariates (SEX, TRT, AGE, BW, HT) and time varying covariates BIOMARKER1, BIOMARKER2 have impact on the ENDPOINT. I see drug treatment effect to some extend but would like to know if it significant.
See also screenshot of the dataset structure. The real data have a trend which admittedly is not visible here, sorry for that.
Multiple regression reads
model <- lm(ENDPOINT ~., data = DF)
Linear mixed effect model, using TRT as grouping variable, would read
model <- lmer(ENDPOINT ~ TIME + WT + HT + BIOMARKER1 + BIOMARKER2 + (TIME | ID) + (1 | TRT), data = DF)
So the question is, which model is appropriate? Multiple regression or linear mixed effect model? Multiple regresssion assumes constant predictors if I understand correctly so that means it is not suitable in this case, am I right?
Any comments would be very appreciated.
UPDATE2: In the meantime I ran the linear mixed effect model on real data, lmer, and get this output:
UPDATE3: I have changed the model formulation as suggested by @Sointu and it runs even with additional variables, now using 'lmer' from lmerTest package.
model <- lmer(ENDPOINT ~ TIME + TRT + SEX + AGE + WT + BIOMARKER1 + BIOMARKER2 + (1 | ID), data = DF)
However, it looks like I have nothing significant if I interpert it correctly when looking at the p-values.