CecileProust-Lima / lcmm

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

object 'Y' not found in hlme #280

Closed petomer-codes closed 1 month ago

petomer-codes commented 1 month ago

Hi all,

I'm currently trying to implement hlme to detect latent class trajectories in my longitudinal data; however, I am having an issue in determining the number of optimal groups. Models with ng = 1 ran without an issue (this is how df = 5 was determined).

Here is the code causing the issue: m2f <- hlme(centered_x ~ ns(age, df=5), random =~ 1, mixture = ns(age, df=5), subject = 'ID', data = data_f, ng = 2) returns the error: Error: object 'age' not found.

I have removed NA values for age, and ensured that it is present in the data set, so I don't know quite what to do next.

Thanks in advance!

petomer-codes commented 1 month ago

Hi all, I figured out my issue -- I was missing a '~' in the mixture command.