2
$\begingroup$

I have more of a stats question regarding mixed models.

Here is an example of a mixed model: enter image description here

salary ~ years_experience + (years_experience|department)

Salary is the salary of university faculty based on their years of experience. In this model, we account for the fact that different departments (our random effect) may have different starting salaries (random intercept) and different increases in salary/year (random slopes). So each department will have a different intercept and a different slope.

What I do not understand is what happens when you have multiple continuous fixed effects? For example, if you had two continuous x fixed effects, your predictors would take the shape of a plane (see image).enter image description here

Where would the random slopes and intercepts end up on this plane? Would your random slopes and intercepts have a third dimension? Would it then be possible to visualize this in 2D like in the single fixed effect example?

$\endgroup$

1 Answer 1

1
$\begingroup$

Your formula:

salary ~ years_experience + (years_experience | department)

can be understood as looking for a separate 2D plot for each department. And you then just merged all those 2D plots into a single one, indicating the extra (discrete) dimension for department by color.

Now, if you add an additional continuous fixed-effect variable like age, e.g.:

salary ~ years_experience + age + (years_experience | department)

you can picture this as a separate 3D plot, like the one you posted, for each department. You could again merge this in a single 3D plot with several planes, each plane describing a different department, again indicated by different colors. But that would probably easily get messy.

Note that all this still holds if age was, like years_experience, modeled as a mixed effect. And this interpretation would also hold true if you replaced the random interactions with "fixed" interactions. Random interactions and fixed interactions only differ in how the parameters are computed, the geometry is the same (although there are no random interactions between two continuous variables; the expression behind the bar | must evaluate to a factor (at least in lme4)).

$\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.