CecileProust-Lima / lcmm

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

Questions regarding predicted trajectories and weighted subject-specific predicitons #262

Closed Esther-ye2024 closed 1 month ago

Esther-ye2024 commented 5 months ago

Hi @CecileProust-Lima, @VivianePhilipps,

Thank you very much for developing package.

I am using the lcmm package to identify latent classes. I encountered two problems.

  1. I run the hlme() function on longitudinal outcome for anxiety z score. The original z score outcome has a minimum of -1.76 and a maximum of 5.80. When I plot the predicted trajectories, one trajectory decreased to lower than -10. I was wondering if the predictY showed the exact predicted z score and how to interpret the predicted trajectory for the z score. Here are my code and plot.

    data_pred <- data.frame(Time=seq(4,16,length.out=50))
    data_pred$Time10 <- (data_pred$Time - 4)/10
    pred <- predictY(lcga2, data_pred, var.time = "Time")
    plot(pred, col=c("red","navy"), lty=1,lwd=5,ylab="anxiety",xlab="age",legend=NULL,  main="Predicted trajectories for anxiety ",ylim=c(-10,5))

    l image 1

  2. I followed the code in the vignette to plot Graph of the predictions versus observations.

plot(lcga2, which="fit", var.time="Time", marg=FALSE, shades = TRUE)

The plot was different from my predicted trajectory in terms of the trajectory and x axis values. Could you please let me know how to solve this problem.

image 2

Thank you very much in advance for your help with this issue and kind regards, Esther

VivianePhilipps commented 4 months ago

Hi Esther,

maybe there is a confusion between your two time scales Time and Time10. Which one do you use in the lcga2 model? And what is the distribution of these time values in your dataset?

Viviane