I've been working on a longitudinal study using a linear mixed-effects model in R. I wonder if there is any way to visualize the results of the linear mixed-effects model. The problem in my situation is both independent and dependent variables are continuous (there is no group in independent variables)

Here, A is the continuous dependent variable and B is the continuous independent variable. There are multiple records for each patient on different dates, which makes it a longitudinal study. I want to figure out the relationship between A and B.

My model: lmer(A ~ B + date + (date | patient_number))

summary(my model):

Linear mixed model fit by REML. t-tests use Satterthwaite's method [
A ~ B + date +  
    (date | pNo)
   Data: brain

REML criterion at convergence: 7140.9

Scaled residuals: 
     Min       1Q   Median       3Q      Max 
-2.83833 -0.51345 -0.01059  0.50652  2.49285 

Random effects:
 Groups   Name           Variance  Std.Dev.  Corr 
 pNo      (Intercept)    2.210e+07 4.701e+03      
          date           2.691e-03 5.187e-02 -1.00
 Residual                2.195e+07 4.685e+03      
Number of obs: 355, groups:  pNo, 150

Fixed effects:
                            Estimate Std. Error       df t value Pr(>|t|)    
(Intercept)                 26248.29    3431.73   171.06   7.649 1.41e-12 ***
B                           22316.31    3790.37   297.06   5.888 1.06e-08 ***
date                        -379.54      49.69   143.87  -7.639 2.81e-12 ***
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
*Warning in abbreviate(rn, minlength = 6) :
  abbreviate used with non-ASCII chars*
               (Intr) B.
B               -0.529       
date           -0.861  0.046
optimizer (nloptwrap) convergence code: 0 (OK)
boundary (singular) fit: see ?isSingular

I got this result. It converged but it doesn't seem like it’s non-singular.

I wonder if the result is correct. If so, is there any way to visualize it? I don't know what kind of visualizations there are, but I just want some way to visualize the result to make it more understandable to people. Any method is welcomed!

  • 2
    $\begingroup$ This isn't directly related to your question, but just FYI, I've found refitting models like this in a Bayesian framework almost always solves the singularity/non-convergence problem (because of slight regularisation of the random effects). R package brms uses the same syntax as lmer() and the results are easily plotted using function conditional_effects(). Give it a look if interested. $\endgroup$
    – Lachlan
    Aug 12 at 3:37
  • $\begingroup$ Thank you. I will try it out! $\endgroup$
    – kkccyy
    Aug 12 at 4:21