CecileProust-Lima / lcmm

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

Some questions about Latent Classes and Latent Processes using R #165

Closed lijiaqi-github closed 8 months ago

lijiaqi-github commented 1 year ago

Dear Cécile and dear Viviane,

Thank you for your great package.I am reading your Estimation of Extended Mixed Models Using Latent Classes and Latent Processes: The R Package lcmm and have some questions.

  1. For the situation that some participants only had one or two participations. Should I exclude the ones with less attendance. If yes, what should be the minimum number of participations.

  2. In page 41 "6.5. Jointlcmm examples, you said that "Note that the survival model only handles time-independent covariates". For example, in following model, we could not add time-varying variables such as ADL score in " survival = Surv(age_init, agedem, dem) ~ CEP + male", but could in " normMMSE ~ poly(age65, degree = 2, raw = TRUE) + CEP", is it right? or both one not? If I want to adjust ADL in survival model, I need to adjust baseline ADL. Is it right?

    mj1 <-
    Jointlcmm(
        normMMSE ~ poly(age65, degree = 2, raw = TRUE) + CEP,
        random = ~ poly(age65, degree = 2, raw = TRUE),
        survival = Surv(age_init, agedem, dem) ~ CEP + male,
        hazard = "Weibull",
        subject = "ID",
        data = paquidS,
        ng = 1
    )
  3. When I want to adjust the competition risk. For example, in "survival = Surv(age_init, agedem, dem) ~ CEP + male", dem= 2 is mortality (dem = 0: no dementia, dem = 1: dementia). the model shoud be "survival = Surv(age_init, agedem, dem) ~ cause1(CEP) + cause1(male)". Just adding cause1() ? or there is other code.

  4. In page 41 "6.5. Jointlcmm examples, you give following code illustrates a reestimation of the three-class model using estimates of the two-class model as initial values along with arbitrary initial values for an additional class:

    Binit <- rep(0, length(mj2$best) + 6) 
    Binit[c(2, 5:10, 12, 13, 15, 16,18, 19:(length(Binit)))] <- mj2$best
    Binit[c(1, 3, 4, 11, 14, 17)] <- c(0, 0.11, 4, 70, 0, 0)

    What I don't understand is how to determine where the parameters need to be added, and the logic of adding parameters. In the example in the text. The parameters are added at [c(1, 3, 4, 11, 14, 17)], and the added parameters are c(0, 0.11, 4, 70, 0, 0). I don't understand what the basis for these numbers is.

I look forward to hearing from you, and greatly appreciate any insight you have.

jiaqi li

VivianePhilipps commented 1 year ago

Hi,

please find here some clarification regarding your points.

  1. There is no need to exclude subjects with few measurements. The mixed model makes use of all information to estimate the trajectory, even if a single observation is available for some subjects.

  2. You can include time-dependent variables in the fixed part (formula normMMSE~poly(age65, degree = 2, raw = TRUE) + CEP in this example). But for the survival part, only values at one specific time point (at baseline) can be included.

  3. Such a specification is correct. The CEP and male variable will only have an effect an the hazard of dementia in that case.

  4. Here we start from a 2 class model and add one class. We chose to second class (over the 3 total classes) to be the new one. The parameters related to class 2 are at position 1,3,4,11,14,and 17. Either you manage to determine these positions, which is not so obvious, either you run a 3 class model without optimization mj3_0 <- Jointlcmm(.., ng=3, B=mj1, maxiter=0) and see from mj3_0$best where are the class 2 parameters. Regarding the values we give to these parameters, they are rather arbitrary. We just make sure they make sense, but we don't strictly justify this choice. For example, we put 70 for the intercept in the mixed model. You see from figure 3 in the paper that the intercepts are between 60 and 80, so 70 sound possible.

I hope this will help!

Viviane

lijiaqi-github commented 1 year ago

Dear Viviane,

So many thanks for you kind and careful explanation. That is very helpful.

I'll try to analyze it again based on your reply.

Jiaqi li

lijiaqi-github commented 1 year ago

Dear Viviane,

Thank you again for your great package.

I am reading your vignette. I am not sure if there is something I missed, but I encountered an error message when I executed the following code. https://cecileproust-lima.github.io/lcmm/articles/latent_class_model_with_hlme.html#description-of-the-2-class-linear-mixed-model

Description of the 2-class linear mixed model Summary of the model

hlme(fixed = normMMSE ~ age65 + I(age65^2) + CEP, mixture = ~age65 + 
    I(age65^2), random = ~age65 + I(age65^2), subject = "ID", 
    ng = 2, data = paquid)
  Error in hlme(fixed = normMMSE ~ age65 + I(age65^2) + CEP, mixture = ~age65 +  : 
  Please specify initial values with argument 'B'

After adding "B = m1," the code worked perfectly.

I am not sure if there is any code that I missed. Just in case, I want to report this error.

lijiaqi-github commented 1 year ago

Very sorry for asking so many questions.

I want to know how to determine the class of the original data using the predictive model.

For example, when I have a predictive model m3, and I want to determine which class the people in the original data (paquid) belong to, what should I do?

Thank you very much.

VivianePhilipps commented 9 months ago

Hi,

you will find the classification in the $pprob output of the model (m3$pprob).

Viviane