4
$\begingroup$

I'm struggling to set random effects for my linear mixed effect model. I've been trying to go about it using a top down approach in accordance to Zuur et al. (2009), but due to the fact that you have to specify a model with a complexity beyond what you expect or want, defining the combinations of random effects for the model is proving to be challenging.

The problem I have stems from the fact that most literature/guides/tutorials I've seen give basic examples on how to set random effects and rarely venture past defining basic slopes and nesting.

My study is one where all participants were exposed to the same treatments on different days (5 treatments in total), the order was randomized. So my grouping variable is participant. During each treatment 8 five minute blood pressure measurements were taken. So my dependent variable is blood pressure and my fixed effects are treatment and which 5 minute window the measurement belongs to (an ordinal categorical variable with 8 levels). Other random effects I chose to include to try to explain as much variance as possible are

  1. Visit number - which visit in sequence it was for each treatment.
  2. Age of participant
  3. BMI of participant
  4. Respiratory frequency during 5 min measurement
  5. How physically active the participant is
  6. How the participant experienced the whole ordeal
  7. How much sleep the the participant getting

So i defined the fixed effects as such:

model <- lmer(blood_pressure ~ treatment * 5_min_window + sex, data=data_all)

I added in sex since it can't be a random effect with only 2 levels.

The problem starts when adding random effects. My first question is should I define random slopes corresponding to all of my fixed effects? So for example:

(blood_pressure|person) + (treatment|person) + (sex|person) + (blood_pressure|visit_number) + (treatment|visit_number) etc. 

Should the within subject grouping be such that i add all fixed effects? Something in line with (treatment * 5_min_window|person).

Also of note is the presence of 8 five minute measurements during each treatment. Should nesting be somehow incorporated?

Once the beyond optimal model is defined the algorithm to prune it down is straight forward. But getting to that beyond optimal model is challenging. It feels like it's something you get much better at with experience or maybe not. Either way any help will be highly appreciated.

$\endgroup$

1 Answer 1

5
$\begingroup$

I have never liked this type of approach to specifying a mixed model. In my opinion, the model should reflect the experimental design, and not be an artifact of a data-driven process. One very good reason for this is that models that are specified based on an exploration of the data are far less likely to generalise to new data or different population because there is a real risk of overfitting. This was the subject of a paper by Douglas Bates (one the primary authors of the nlme and lme4 package) and colleagues where they argued rather strongly against a similar approach that gained a lot of interest, called a "maximal" model (Bates et al, 2015)

Following the publication of the "keeping it maximal" paper by Barr et al (2013), this site was strewn with a large number of questions from people trying to implement the maximal model approach, and finding that their fitted models were singular. This was almost always because the random structure was far too complex (ie, the model was overfitted). Now to address your actual problem:

You appear to have two grouping factors that you want to fit random intercepts for: person and visit_number. From your description, these factors appear to be crossed, not nested. So no problem there.

My first question is should I define random slopes corresponding to all of my fixed effects?

You should fit random slopes when you expect, a priori, there to be significant variation in the fixed effects within the relevant grouping variable. This is usually requires a very good understanding of the domain. When estimated, if it turns out that the variance for the slopes is extremely small, or can't be estimated due to the model being singular, then remove it. Otherwise retain it !

Should the within subject grouping be such that i add all fixed effects? Something in line with `(1 + treatment * 5_min_window | person) ?

Again, only do this is you have good reason to expect the effects of treatment, the window and all their interactions to vary significantly by person

Also of note is the presence of 8 five minute measurements during each treatment. Should nesting be somehow incorporated?

I assume this means that for each visit_number for each person, the respiratory frequency was measured 8 times ? I assume this was done for precision. In which case just take the average.

References

Barr, D. J., Levy, R., Scheepers, C., & Tily, H. J. (2013). Random effects structure for confirmatory hypothesis testing: Keep it maximal. Journal of memory and language, 68(3), 255-278.

Bates, D., Kliegl, R., Vasishth, S., & Baayen, H. (2015). Parsimonious mixed models. https://arxiv.org/abs/1506.04967

$\endgroup$

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.