Home › forums › Mixed Models › Model equation for correlated and uncorrelated random slopes
This topic contains 2 replies, has 2 voices, and was last updated by blazko m. (b1azk0) 2 months, 2 weeks ago.

AuthorPosts

July 30, 2018 at 18:30 UTC #297
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: linearmixedeffectsmodelequation[…]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/rguidelongitudinallmelmer][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 2level factors fully balanced withinsubjects
– **C** is a dichotomous (*yes* or *no* response) independent variable
– **Y** is the outcome
– *The 3way interaction within fixed effects is of main interest*How can I write down a linear equation for two
mixed()
mixedeffects 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/rguidelongitudinallmelmer
[2]: https://stats.stackexchange.com/q/358927/133561 
July 31, 2018 at 13:31 UTC #298
From
?afex::mixed
:Expand Random Effects
expand_re = TRUE
allows to expand the random effects structure before passing it tolmer
. 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 withrei
(wherei
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)

July 31, 2018 at 13:49 UTC #299
Henrik I know that… that’s my 2nd model.
I m interested in a mathematical (statistcal?) equation for these two models.

AuthorPosts
You must be logged in to reply to this topic.