CecileProust-Lima / lcmm

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

LCMM error #220

Closed pitina244 closed 7 months ago

pitina244 commented 8 months ago

Hi,

I am running my model using all different link functions LCMMmodel <- lcmm(myout ~ age + sex + educ + myoutbaseline, random=~ year, subject='IID', data=mydata) HLMEmodel <- hlme(myout ~ age + sex + educ + myoutbaseline, random=~ year, subject='IID', data=mydata) SPLINESmodel <- lcmm(myout ~ age + sex + educ + myoutbaseline, random=~ year, subject='IID', data=mydata, link='5-quant-splines')

and only lcmm has an error

Numerical problem by computing fn value of function is : NaN

Would appreciate any suggestions on what is wrong/how to fix!

thanks in advance

phoebesco commented 8 months ago

Hi, I am running into a similar error message so wanted to follow-up on this. I am running my model with a few different link functions and only encounter this error for the linear model. The marker I'm using is continuous and approximately normal. I will likely end up using hlme rather than lcmm, but would like to run a linear lcmm model so that I can compare it to the models using other link functions.

This model produces the message: m1_lin <- lcmm(marker ~ TimeYr, random =~ TimeYr, subject="id", data=combo_df, var.time="TimeYr") Numerical problem by computing fn value of function is : NaN

These models run without any problems: m1_beta <- lcmm(marker ~ TimeYr, random =~ TimeYr, subject="id", data=combo_df, var.time="TimeYr", link='beta') m1_5Espline <- lcmm(marker ~ TimeYr, random =~ TimeYr, subject="id", data=combo_df, var.time="TimeYr", link='5-equi-splines') m1_5Qspline <- lcmm(marker ~ TimeYr, random =~ TimeYr, subject="id", data=combo_df, var.time="TimeYr", link='5-quant-splines')

Thank you!

VivianePhilipps commented 7 months ago

Hi,

this message indicates an internal computation issue. This is usually fixed by specifying different initial values in argument B. To see the default initial values, you can run for example lcmm(myout ~ age + sex + educ + myoutbaseline, random=~ year, subject='IID', data=mydata, maxiter=0)$best

And then, give in B a slightly different vector of initial values m <- lcmm(myout ~ age + sex + educ + myoutbaseline, random=~ year, subject='IID', data=mydata, B=c(...))

Viviane

phoebesco commented 7 months ago

Thank you!