CecileProust-Lima / lcmm

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

Perform splines on link function and splines function of time #205

Closed tinaty closed 10 months ago

tinaty commented 1 year ago

Hi, I tried to use different link functions and different functions of time when fitting latent class mixed models on continous outcomes. I wonder what is the difference betweenlink='splines'and splines function of time by using splines::ns(time)? Can I use splines link function and in the meantime use splines::ns(time), i.e.m3 <- lcmm(fixed = y ~ splines::ns(time), random=1+time, mixture= splines::ns(time), link='splines', ng=3, subject='id', data=mydata)? Thank you for your advice.

VivianePhilipps commented 1 year ago

The splines link function refers to the distribution of the outcome, whereas the ns you use refer to the trajectory with time of your outcome. So both can be used simultaneously if you have a non-Gaussian outcome and you wish to have flexible trajectories with time.

tinaty commented 1 year ago

Thanks Viviane, is there a way that could be used to determine which link function is the best?

tinaty commented 1 year ago

@VivianePhilipps Hi Viviane,

Thank you for your advice.

As I have a non-Gaussian outcome, I first tried a splines link and splines function of time simultaneously, i.e. m3Splines <- lcmm(fixed = y ~ splines::ns(time), random=1+time, mixture= splines::ns(time), link='splines', ng=3, subject='id', data=mydata).

I also tried a model with a linear link and splines function of time, i.e. m3Linear <- lcmm(fixed = y ~ splines::ns(time), random=1+time, mixture= splines::ns(time), ng=3, subject='id', data=mydata).

However, m3Splines shows much worse entropy (0.77) than the entropy of m3Linear (0.90). I have enclosed the subject specific residuals of m3Splines and m3Linearbelow. Could you kindly advise if I should choose the model m3Linear given that the primary goal of Latent Class Mixed Modeling is to capture heterogeneity in longitudinal trajectories, so the focus should be on the interpretation of the latent classes themselves despite the non-normality?

image image
VivianePhilipps commented 10 months ago

Hi,

we usually choose the link function in one class models. We estimate the several models differing only by the link function and choose the "best one", for example the one with better AIC. Then, we add latent classes and keep always the same link.

Best,

Viviane

tinaty commented 10 months ago

Thanks a lot Viviane for your kind advice