I've now spent quite a bit of time doing research on linear mixed models in R using lme4 and lmer. However, I still read conflicting advice on how to best fit the model.
This is my data: Longitudinal clinical data (0-10 years, fixed observation intervals) with clinical and laboratory values from each observation point.
The question I'm trying to answer is how certain laboratory values (numerical) or conditions (categorical) affect others.
So my random effect is my patient id.
The model I use is: outcome ~ fixed_effect1 * fixed_effect2 * age + (1 | patient_id)
However, there are some questions that come to my mind and that I couldn't answer: 1) The effects I'm looking at might also lead to a more accelerated decline of outcome, so i'd need to do a slope analysis, right? Would this mean that I use (age | patient_id), for example? 2) I have two similar fixed effects, age and observation_time (years after study started). How should I consider this?
Any help is highly appreciated, thank you!
Best
Edit 1
Thank you very much for your kind introduction and reply. So, to get it straight. I have an outcome, and I suspect different other data to have an impact on it:
Obviously, it is a longitudinal data set, so I put Age/Observation_Time as fixed effect - There is some baseline grouping (i.e. diseased, not diseased), which I suspect to accelerate or decelerate the developement of my outcome variable by time/Age/etc (this variable is the same in every table line of my results table for every subject). I put this grouping variable as slope effect, right? - There are some other variables which might influence my outcome over time, so I put them as other fixed effects?
The model I get is then:
outcome ~ fixed_effect1 * fixed_effect2 * age + (1 + baseline_grouping | patient_id)
Edit 2 So I took some time to construct my model. I have scaled all relevant fixed_effects as proposed by Schilzeth et al. 2010 (using as.numeric(scale(.))) The model now goes:
lmer(outcome ~ fixed_effect1 * age + fixed_effect2 * age + baseline_grouping + (1 + age | patient_id)
So for the fixed_effectN * age combinations, this reads like: I allow the effect of age/time/whatever to vary between different levels of fixed_effectN, right? And I like your explanation for (1 + age | patient_id): This allows the effect of age to vary between patients (as patient_id), right?
Do I actually need the "1+age" or would "age" be the same? (It should be, according to https://bbolker.github.io/mixedmodels-misc/glmmFAQ.html#model-specification)