I have a linear mixed-effect model in R with two continuous fixed-effects and one random effect, like this:


To graphically display the independent effect of x1 on y, while controlling the effects of x2 (fixed effect) and r (random effect), is it appropriate to do a partial regression plot using the same logic used for multiple linear regression models? I.e.:

                          #removing the effect of x2 and r on y


                          #removing the effect of x2 and r on x1


              #partial regression plot to display the pure effect of x1 on y


Also, I used the "plotLMER.fnc function" from the "LMERConvenienceFunctions" R package to plot the partial effect size of each fixed effect as follows:


However, I am not sure what this package means by "effect size". Is it β1 and β2?

I will be very grateful for any help in this issue.

  • $\begingroup$ You might be better on an R-specific site like R-help or asking the package maintainer. $\endgroup$ – mdewey Jan 26 '17 at 15:00
  • $\begingroup$ Please provide some example data. $\endgroup$ – Sven Hohenstein Jan 26 '17 at 15:11

You can use the remef package to prepare data for the visualization of partial effects. The package can be installed with devtools.


To remove the influece of x2 and the random effects from the dependent variable, you can use

y_partial <- remef(model, fix = "x2", ran = "all")

This will create a modified version of y based on the partial effect while the residuals are still present. Hence, you can still visualize the deviations from the predictions.

With the adjusted data y_partial you can, for example, create a plot of y_partial as a function of x1 together with a linear regression line.

Disclaimer: I am the author of the remef package

| cite | improve this answer | |
  • $\begingroup$ It worked, thanks a lot! Is there a code to compute the partial R^2? $\endgroup$ – Artur Wanderley Jan 27 '17 at 12:53
  • $\begingroup$ @tomzer I'm sorry, I don't have a solution for this paricular task. $\endgroup$ – Sven Hohenstein Jan 27 '17 at 13:36

I used the Effect function from the effect package for this.


est<-Effect("x1", partial.residuals=T, model1)
| cite | improve this answer | |
  • $\begingroup$ Welcome to CrossValidated @Seraina! Try improving the quality of your answer by explaining why your proposed solution is the right answer and how it works to make it as useful as possible for others who might be struggling with the same problem. $\endgroup$ – Jan Kukacka Feb 6 '18 at 9:17
  • 1
    $\begingroup$ This answer is totally perfect, clear and helpful, no need for clutter it with unnecessary bs. Good job Seraina! $\endgroup$ – Curious Jul 8 '19 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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