philips-software / latrend

An R package for clustering longitudinal datasets in a standardized way, providing interfaces to various R packages for longitudinal clustering, and facilitating the rapid implementation and evaluation of new methods
https://philips-software.github.io/latrend/
GNU General Public License v2.0
28 stars 5 forks source link

error in latent profile analysis function #138

Closed janstochl closed 1 year ago

janstochl commented 1 year ago

Hi, I cannot make the latent profile function work, I get the following error:

llpa <- lcMethodMclustLLPA("hae3",id = "subjid", time = "tpn", nClusters = 2) model <- latrend(llpa, hae_3)

  • Longitudinal clustering using: longitudinal latent profile analysis

    Method arguments: time: "tpn" id: "subjid" nClusters: 2 modelNames: NULL prior: NULL control: emControl() initialization: NULL warn: mclust.options("warn") x: NULL response: "hae3"

    Checking and transforming the training data format. Preparing the training data for fitting... Fitting the method... fitting ... |======== | 7%Error in meEII(data = data, z = z, prior = prior, control = control, warn = warn) : NA/NaN/Inf in foreign function call (arg 2)

FYI my data ndo not include any Inf, NA or NaN values. It looks like it is related to specification of argument "z" in mclust function meEII, which according to mclust package is "A matrix whose [i,k]th entry is the conditional probability of the ith observation belonging to the kth component of the mixture."

Can you kindly check the issue please?

Thanks, Jan

niekdt commented 1 year ago

Hi, the error thrown by the mclust::Mclust function is usually caused by convergence problems.

Before diving deeper, you may first want to try to:

Hope this helps

janstochl commented 1 year ago

Dear Niek, many thanks for your helpful response. The issue was indeed that some individuals did not have all timepoints in the datasets. I did not know this was a requirement for mclust. This is quite restrictive as it is often the case that some timepoints are missing, You also cannot add them (and fill with missing values) since missing data are not allowed in mclust either. Strange.

Anyway, I wanted to thank you very much for your kind guidance and also for fantastic latrend package.

All the best, Jan

Dne 14.09.2023 15:46:06, Niek Den Teuling @.***> napsal:

Hi, the error thrown by the mclust::Mclust function is usually caused by convergence problems.

Before diving deeper, you may first want to try to:

Hope this helps

— Reply to this email directly, view it on GitHubhttps://github.com/philips-software/latrend/issues/138#issuecomment-1719599906, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APXTWHH7CLYUIMQPUQMGAMDX2MKCRANCNFSM6AAAAAA4X2GX2I. You are receiving this because you authored the thread.Message ID: @.***>

niekdt commented 1 year ago

Dear Jan,

It is restrictive indeed, but there are alternatives. If the missing data mechanism is non-informative, consider imputing the values, or use a parametric method. The kml package has some built-in options to impute data, which you can use through lcMethodKML. For a parametric approach that can yield results similar to LLPA, GBTM is a good option (see lcMethodLcmmGBTM.

If data is MNAR then you're in rough terrain as standard methods will not be applicable. Pattern mixture modeling will be of help here.

Best regards, Niek

janstochl commented 1 year ago

That is super helpful, thank you Niek.

Jan

Dne 18.09.2023 9:17:11, Niek Den Teuling @.***> napsal:

Dear Jan,

It is restrictive indeed, but there are alternatives. If the missing data mechanism is non-informative, consider imputing the values, or use a parametric method. The kml package has some built-in options to impute data, which you can use through lcMethodKML. For a parametric approach that can yield results similar to LLPA, GBTM is a good option (see lcMethodLcmmGBTM.

If data is MNAR then you're in rough terrain as standard methods will not be applicable. Pattern mixture modeling will be of help here.

Best regards, Niek

— Reply to this email directly, view it on GitHubhttps://github.com/philips-software/latrend/issues/138#issuecomment-1722946415, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APXTWHFPEB36EGMQ2N63YZDX277QBANCNFSM6AAAAAA4X2GX2I. You are receiving this because you authored the thread.Message ID: @.***>