CecileProust-Lima / lcmm

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

R update #143

Closed dtownsend2022 closed 10 months ago

dtownsend2022 commented 1 year ago

Hi!

I have a bit of a vague question, as I have been having some issues with the LCMM function since I updated my R. I was receiving an error about specifying the B argument and resolved that using one of the posts here. Since then, however, I have been receiving this error for only one of my functions: Error in chol.default(vbb) : the leading minor of order 7 is not positive definite

I have included an example below. The first function runs, but the second is where I receive the error. I see a similar error listed here, but I'm not sure that it was resolved. My main issue is that this code runs for a coworker who has an outdated version of R, but kicks this error back to me when I run it.

mod1 <- lcmm(outcome ~ timey1 + timey2 + timey3 + timey4, random = ~time, subject='ID', ng = 1, idiag = FALSE, data = data, link = "beta", verbose = FALSE) mod2 <- lcmm(outcome ~ timey1 + timey2+ timey3 + timey4, random = ~time, subject='ID', mixture = ~time, ng = 2, idiag = FALSE, data = data, link = "beta", B = random(mod1), verbose = FALSE)

Any advice would be much appreciated!

dtownsend2022 commented 1 year ago

Just realized there should be a * between each time and y argument

CecileProust-Lima commented 1 year ago

Hi, sorry for the late response, the co-maintainer Viviane is currently not available. I am sorry you encountered this issue. We have not been able to reproduce the error. Would you have a code that fails using the data of the package so that we can explore? Cécile

giguerch commented 1 year ago

m11<-lcmm(Ydep2~Time+I(Time^2),random=~Time+I(Time^2),subject='ID',ng=1, data=data_lcmm,link="beta",B=c(-0.9109, -0.0831, 0.5194, 0.1910 , 0.8984, -0.0179, -0.0636, 0.0045, 0.5514, -0.7692, 0.7037, 0.0899)) Erreur dans chol.default(varcov) : le mineur dominant d'ordre 3 n'est pas défini positif

dtownsend2022 commented 1 year ago

Hi again! I am attaching an example that creates a new error for me (Error in .Contlcmm(fixed = fixed, mixture = mixture, random = random, : Please specify initial values with argument 'B') and another person who have updated versions of R, but doesn't for someone who has an outdated version of R. In the example, the lcmm_test line returns an error for me, but lcmm_test_1 and _2 don't when I specify the initial values. However, the first works fine for my coworker with the outdated version of R and no initial values. The bottom of the script includes our R versions. lcmm_test_paquid.txt

VivianePhilipps commented 1 year ago

Hi,

this is a change we made in lcmm since version 2.0.0. In earlier versions the model with ng=1 was internally estimated to get initial values, but now you have to specify initial values when ng>1, with B=lcmm_test_1 or B=random(lcmm_test_1) as you did.

Best,

Viviane