I am running the following model in R:

      model = lmer(Tau ~ ageS*days+YrsOfEds*days+sex*days+tract*days + (1|SubjectID), data=long)

With this model I am trying to predict change in tau over time based on the quality of a tract. Both tau and tract are continuous variables (scaled as R complained about the scale... but still is...). Since this is a biological relationship, I have included subjects as random intercept, as this may be different across subjects (I think that my sample size is too small and my time points are too little to test random slopes) Days is also continuous, as this might save me DOF and there is some variability across subjects on when they were exactly tested. We are still collecting data, so far I have 118 subjects for baseline, 32 for follow-up moment 1 and 3 for for follow-up moment 2.

Then I wanted to plot how tau changes over time in relation to tract quality. That seems to be more difficult. I have used sjPlot for that using this command:

    sjp.glmer(model, type="fe.pc")

(tract and time are modeled as fixed effects, so I thought this was the best option to go for).

I then get this plot:


While this looks great and the effects are in the correct direction, I have trouble understanding this plot. What am I looking at? For example: the HippCing_FAS is the tract quality measure: does this mean that higher values have a low probability of predicting a change in tau?

Any help would be greatly appreciated! Many thanks!!


You have fittes a linear (lmer) model, so you should use the sjp.lmer function. For the above plot, predicted probabilities only worked with binomial models with logit-link function. However, I made a major overhaul of my package, so I recommend downloading the current GitHub Snapshot, which will be submitted to CRAN the next days (you can download the latest snapshot of the sjPlot-package here). The update has many improvements for the effects- and predictions-plots, as well as different model families and link functions for glm(er) models are supported now.

To come back to your plot: For predicted probabilities, the function now does following:

the predicted values are based on the fixed effects intercept's estimate and each specific fixed term's estimate. All other fixed effects are set to zero (i.e. ignored), which corresponds to family(fit)$linkinv(eta = b0 + bi * xi) (where xi is the estimate of fixed effects and b0 is the intercept of the fixed effects; the inverse link-function is used). This plot type may give similar results as type = "pred", however, type = "fe.slope" does not adjust for other predictors.

So, it's a kind of "relationship" of the response and your specific fixed effects term, which does not adjust for other co-variates. If you are interested in marginal effects or predictions, you should use the plot type type = "eff" or type = "pred" (note that the pred plot type from the latest GitHub-build of the sjPlot-package should be used; I added this kind of prediction plots just recently). You find details on what the plots actually do in the Details section of sjp.lmer.

Furthermore, if you are interested in the interaction of days and other predictors, you should use the sjp.int function, which plots interaction effects and / or estimated marginal means (least square means) for a various type of models. See ?sjp.int. Here you can better see the relationship between, e.g., tract and Tau for different days.

Beside the examples, there are "vignettes" for some package functions at http://www.strengejacke.de/sjPlot/. You may want to look at http://www.strengejacke.de/sjPlot/sjp.int/ for the interaction plots (but please note that the vignettes will also be updated with the forthcoming package update).

  • $\begingroup$ Hi Daniel, thank you so much for this wonderful and clear answer. I installed the latest snapshot from GitHub. I looked into the sjp.int function and tried to plot it,but I get this error message: $\endgroup$ – HIL May 1 '16 at 16:00
  • $\begingroup$ As for the sip.lmer function, when I use "eff", I get this error message: Model has no higher order terms (except for possible interaction terms). There are no effects that can be plotted. Consider using sjp.int if model has interaction terms. Does it need polynomial terms? $\endgroup$ – HIL May 1 '16 at 16:06
  • $\begingroup$ Sorry, somehow got cut of in the first part: I tried to plot with sjp.int and the eff type. This is the error I get: Error in labs(title = labtitle, x = labx, y = laby, colour = lTitle) : object 'laby' not found. Not sure why this is popping up? Is there a way to plot time continuous? As in a 3D plot? I know this is more difficult to visualize, but since I have a lot of dropout, I don't want to blow up the upper bound of time (days) $\endgroup$ – HIL May 1 '16 at 16:10
  • $\begingroup$ One more thing, sorry for spamming: when looking at boxplots, I see an increase in tau over time. But using the sjp.int with condition as type, shows me a negative change in tau? Why is this negative? $\endgroup$ – HIL May 1 '16 at 16:52
  • $\begingroup$ Ok, I fixed the bug (see update on GitHub). @ 2. comment: Since you have only interaction terms in your model, your main effects are no longer interpretable. Hence, you have no more "higher order terms" except for your interaction terms - and interaction terms are not plotted in sjp.(g)lmer, but only in sjp.int. @ 3. comment: See my first sentence, bug should be fixed now. What do you mean by "continuous like in 3D plot"? @ 4. comment: yes, type = "cond" shows the mere effect of the interaction on the complete outcome. It shows you the tendency of the interaction, but not the real values $\endgroup$ – Daniel May 1 '16 at 20:15

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.