1
$\begingroup$

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)

$\endgroup$

1 Answer 1

0
$\begingroup$

Welcome to the site! You seem to have a pretty good handle on things. Let me try to address your two questions.

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?

That is a a possibility, and one that your subject matter expertise can speak to. If you add (age|patient) to your random effects structure, this allows for the linear effect of age on the outcome to vary for each person. You will get both an age slope variance and a covariance between the age slope and the intercept. The covariance is centered at age==0, so you may want to make sure that an age value of 0 is meaningful.

2) I have two similar fixed effects, age and observation_time (years after study started). How should I consider this?

This is a good question and again, should be guided more by your subject matter expertise. The advantage of modeling observation_time is that you could code the first year in the study as 0, so that will help in interpreting the age-slope random effect covariance. However, that takes away any information about age. Perhaps older people have steeper slopes. That would be masked with using observation_time. It seems that people start the trial at different ages. You could possibly add a covariate for age of the patient at first measurement and then interact that with observation_time to see if the effect of time in study is different for people of different ages.

Edit based on additional information

Variables that do not vary within subjects (i.e., variables that have the same value for all rows in a given subject) cannot be included in the random part of your model. These variables can only be considered as fixed predictors that are time invariant. Only time-varying predictors (such as age) can be included in the random part of the model as a slope. So in your case, you may want a model such as the following, if you are interested in allowing the effect of age on the outcome to vary across persons:

lmer(outcome ~ fixed_effect1 * fixed_effect2 * age + baseline_grouping (1 + age | patient_id)

You could interact age and baseline_grouping (age:baseline_grouping in the fixed effects portion of your model) to allow a person's age effect to vary based on their baseline_grouping value.

$\endgroup$
5
  • $\begingroup$ Thank you for your kind reply. I updated my question.... $\endgroup$
    – moritz
    Commented Feb 19, 2020 at 18:52
  • $\begingroup$ @user9551890, I updated my response. $\endgroup$
    – Erik Ruzek
    Commented Feb 19, 2020 at 19:01
  • $\begingroup$ thank you again, I edited some information. $\endgroup$
    – moritz
    Commented Feb 19, 2020 at 20:50
  • $\begingroup$ @user9551890, your edit looks good to me. One thing - I would not suggest scaling the age variable. You may want to center age around some fixed constant such that a 0 value is meaningful, but you do not want to z-score it. Also, I suggest you graph the interactions to help you understand what is going on. You can use ggeffects() for this. See cran.r-project.org/web/packages/ggeffects/vignettes/… $\endgroup$
    – Erik Ruzek
    Commented Feb 19, 2020 at 21:37
  • 1
    $\begingroup$ Thank you @Erik Ruzek for your help, I'm now very happy with the analysis and effects plots! $\endgroup$
    – moritz
    Commented Feb 22, 2020 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.