CecileProust-Lima / lcmm

R package lcmm
https://CecileProust-Lima.github.io/lcmm/
48 stars 13 forks source link

Residual plots #243

Closed Tina-Kb closed 3 months ago

Tina-Kb commented 4 months ago

Hi,

I’m a bit confused regarding the way residuals are computed in the residual plots for a group-based trajectory model (GBTM) or growth mixture model (GMM) estimated using lcmm. If I understand correctly, in the subject-specific residuals vs subject-specific predictions, the subject-specific residual is the difference between an individual’s observed value of the outcome at a given time and the corresponding subject-specific predicted value. If, for instance, there are five timepoints, the subject-specific residuals vs subject-specific predictions will have 5 dots for each subject.

In the marginal residuals vs marginal predictions plot, the marginal predictions correspond to the group-specific mean predicted values, but what about the marginal residuals? How are they computed? I noticed that I have five vertical clusters of dots, probably because of the five timepoints. (It’s a 4-class model.)

Also, when it come to the GBTM and GMM assumption that the variance of the errors is the same (1) across time and (2) across groups, is it correct to draw a conclusion for (1) based on the subject-specific residuals vs subject-specific predictions plot, and to draw a conclusion for (2) based on the marginal residuals vs marginal predictions plot?

Thank you!

Tina

VivianePhilipps commented 3 months ago

Hi,

the residuals are always computed as a difference between the observations and the predictions. For subject-specific residuals, as you said, you take the difference between the observations and the subject-specific predictions. For marginal residuals, you compute the difference between the observations and the marginal predictions. And the marginal predictions correspond to a predictions using only the fixed effects (you forget the random effects). In both cases, you have as many residuals as observations.

In mixed models, the goodness-of-fit is rather done using the subjects-specific residuals. Marginal residuals are rarely used because you neglect a part of the model.

Viviane

Tina-Kb commented 3 months ago

Thank you Viviane!