CecileProust-Lima / lcmm

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

Error : model did not converge #228

Closed VivianePhilipps closed 4 months ago

VivianePhilipps commented 7 months ago

A user's question :

Dear Viviane,

We are trying to use the LCMM software and wonder if you/someone can help to figure out what the problem is. We have longitudinal data in a blood biomarker, and we would like to produce trajectories of the levels overtime Seems like we successfully run the code using the following model with just one trajectory

LCMMmodelbeta <- lcmm(loglevels ~ age + sex + educ + year + TotalYears + baselinelevels, random=~year, subject='IID', ng=1, data=mydata, link="beta")

However, when trying to run a model with two trajectories, we keep getting a convergence error

LCMMmodelbeta2 <- lcmm(loglevels ~ age + sex + educ + year + TotalYears + baselinelevels, mixture=~year, random=~year, subject='IID', ng=2, idiag=TRUE, data=mydata, link="beta", B=random(LCMMmodelbeta))

Error in lcmm(log10Ab40 ~ age + sex + educ + year + TotalYears + log10Ab40BA, : Model in argument B did not converge properly

We also try with the gridsearch LCMMmodelbeta3 <- gridsearch(rep = 100, maxiter = 40, minit= LCMMmodelbeta, lcmm(loglevels ~ age + sex + educ + year + TotalYears + log10Ab40BA, mixture = ~year, random= ~year, subject='IID', ng=2, link= 'beta', B=random(LCMMmodelbeta), convG = 1e-05, convB = 1e-05, convL = 1e-05, data=mydata)) Error in gridsearch(rep = 100, maxiter = 40, minit = LCMMmodelbeta, lcmm(log10Ab40 ~ : The model minit did not converge

Thank you in advance for any advice you can propose!

VivianePhilipps commented 7 months ago

If you put a model as initial values either in B=random() or in the gridsearch's minit argument, it is important that this initial model converges properly. This means that the convergence status (here LCMMmodelbeta$conv) should be 1.

It seems here that the one class model doesn't converge. Please see https://cecileproust-lima.github.io/lcmm/articles/usual_problems.html for some advises.