Home forums Mixed Models Model equation for correlated and uncorrelated random slopes

Viewing 2 reply threads
  • Author
    • #297
      blazko m. (b1azk0)

      I know I’ve been a pain recently but this is most likely my last question.
      As before I already posted it on CV with no luck: linear-mixed-effects-model-equation[…]

      I’ve been asked to provide a linear equation for a mixed() model that I report in one paper.

      I tried to adapt examples from [http://rpsychologist.com/r-guide-longitudinal-lme-lmer][1] but this is not my area of expertise and I would like to avoid any guesswork.

      Given a *repeated measurement* experiment dataset where:

      – **A** and **B** are 2-level factors fully balanced within-subjects
      – **C** is a dichotomous (*yes* or *no* response) independent variable
      – **Y** is the outcome
      – *The 3-way interaction within fixed effects is of main interest*

      How can I write down a linear equation for two mixed() mixed-effects models where:

      1. random slopes are correlated
      mixed(Y ~ A*B*C + (A*B*C | Subj), data)
      2. random slopes are uncorrelated due to convergence errors
      mixed(Y ~ A*B*C + (A*B*C || Subj), data)

      PS. Reproducible example of a dataset that simulates my real experiment is posted here: [Compute partial η2
      for all fixed effects anovas from a lme4 model][2]

      [1]: http://rpsychologist.com/r-guide-longitudinal-lme-lmer
      [2]: https://stats.stackexchange.com/q/358927/133561

    • #298

      From ?afex::mixed:

      Expand Random Effects

      expand_re = TRUE allows to expand the random effects structure before passing it to lmer. This allows to disable estimation of correlation among random effects for random effects term containing factors using the || notation which may aid in achieving model convergence (see Bates et al., 2015). This is achieved by first creating a model matrix for each random effects term individually, rename and append the so created columns to the data that will be fitted, replace the actual random effects term with the so created variables (concatenated with +), and then fit the model. The variables are renamed by prepending all variables with rei (where i is the number of the random effects term) and replacing ":" with "_by_".

      Hence, try: mixed(Y ~ A*B*C + (A*B*C || Subj), data, expand_re = TRUE)

    • #299
      blazko m. (b1azk0)

      Henrik I know that… that’s my 2nd model.

      I m interested in a mathematical (statistcal?) equation for these two models.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.