hyunsooseol / snowRMM

Latent Class Analysis(LCA), LCA for ordinal indicators, Latent class growth modeling, Laten Profile Analysis, Rasch model, Linear Logistic Test Model, Rasch mixture model, linear and equipercentile equating can be performed within module.
7 stars 2 forks source link

Problem with LCA in snowRMM #14

Closed salmjoon closed 6 months ago

salmjoon commented 1 year ago

Hello,

I'm trying to conduct a latent class analysis (LCA) in Jamovi by using the snowRMM module.

I succeeded to calculate the class model's fit indices, LCA plots and other details normally, but when I tried to allocate the class memberships for the respondents (N=1446), the memberships got allocated only to ca. 2/3 of the respondents.

I tried the function several times with different models and even with another computer, but the problem continued occuring. What could be the reason for it and how could it be fixed?

Thank you very much for helping!

hyunsooseol commented 1 year ago

Hi salmjoon

Could you share the file that occurs error or send it to snow@cau.ac.kr to see if what happens.

Best Seol

salmjoon commented 1 year ago

Hi Seol,

I can't share the original data, but I made a test file, which also indicates the problem.

So, the data contains 1446 cases and 15 variables + the case id. The variables are ordinal on the 1-5 Likert scale (value 0 is missing data). I conducted a 2-class LCA using all the 15 variables. When it was finished, I selected "Save - Class membership". After that, I went to look at the membership variable on the data sheet. I saw that Jamovi had allocated the class memberships to only the first 81 cases (see the picture attached). I need the class membership for every case.

What could be the reason behind this?

Thank you again for helping!

Picture: The problem Raw data: testdata.xlsx Analysed data from Jamovi: testanalysis.csv

hyunsooseol commented 1 year ago

Hi salmjoon

I am trying to solve the problem. I think the problem might be due to missing data. I will let you know when the problem is solved. Instead of that module, Could you try it with snowLatent module?

Cheers Seol

salmjoon commented 1 year ago

Hi Seol,

thank you for trying to solve it! I already tried the analysis with the original data with snowLatent module, and the class memberships emerged to most of the cases. However, a few (9 out of 1446) didn't still get their memberships to the data.

When comparing those without memberships to the ones that got the memberships, there wasn't any clear difference between them in their answers. Both groups included cases with missing values in the some of the research variables.

hyunsooseol commented 1 year ago

Hi salmjoon It may be that the corresponding case is not converged due to missing value, so membership may be lost.

hyunsooseol commented 1 year ago

Hi salmjoon

Could you check the attached zip file? the snowLatent module is working well. testdata1.zip

salmjoon commented 1 year ago

Hi Seol,

thank you. The snowLatent works perfectly with the test data, but when I try it with my original data, the 9 cases still don't get their class memberships. I don't understand why the memberships wouldn't converge to them, as with the other 1437 cases it works even if they include missing values too . The 9 cases also include a few cases with no missing values at all, and even they don't get the class memberships. Does this make sense?

hyunsooseol commented 1 year ago

Hi salmjoon

the attached testdata.omv is the original data file that you sent me before in which I treated 0 as missing value in jamovi option.

salmjoon commented 1 year ago

Hi salmjoon

the attached testdata.omv is the original data file that you sent me before in which I treated 0 as missing value in jamovi option.

Hi Seol,

I'm sorry for being unclear. That testdata.omv was just a test file I made up, because I can't share my original data set due to data privacy restrictions.

With that testdata.omv the snowLatent module worked perfectly now and allocated the class memberships of LCA to each case. But when I tried the same with my original data set, the class memberships were still left out of nine last cases. These nine cases don't differ from the other cases that got the memberships: both include cases with some missing values in the variables. Thus, it seems that the problem isn't the missing values as they didn't prevent the class memberships to form in the other 1437 cases.

Was I any clearer now?

hyunsooseol commented 1 year ago

Hi salmjoon

Thanks for your reply. I think the snowLatent and snowRMM module are based on the algorithm of glca and poLCA R package. so the beyond of my ability. anyway, I wil think of that. ^^

Cheers Seol

salmjoon commented 1 year ago

Hi Seol,

alright, I understand. Anyhow, thank you so much for trying to help me! I really appreciate it.

hyunsooseol commented 1 year ago

Hi salmjoon

This is what poLCA R package handles missing data below; na.rm
Logical, for how poLCA handles cases with missing values on the manifest variables. If TRUE, those cases are removed (listwise deleted) before estimating the model. If FALSE, cases with missing values are retained. Cases with missing covariates are always removed.

Therfore, I inserted na.rm=FALSE in the main function poLCA::poLCA(), which is working well. but when the missing covariates are entered, because of missing covariates are always removed in R, the ID and membership does not matched each other. I will push it to jamovi library this week.

Cheers Seol

salmjoon commented 1 year ago

Hi Seol,

thank you for the clarification! I'll wait for your update on the module and test the analyses with snowRMM then again. Meanwhile, I'll try to use the snowLatent module as far as I can.

Cheers! salmjoon

hyunsooseol commented 1 year ago

Hi salmjoon

I already pushed it to Jonathon. It will be available today and I will let you know.

With the update module, The membership will be retained when the covariates are not entered. However, the covariates are entered, the missing cases will be removed with the listwise method. Therefore, the ID and membership does not match each other. This result is already confirmed by R studio. One thing that you remember is that when the covariates with no missing are entered, the membership is working well.

Cheers Seol

salmjoon commented 1 year ago

Perfect, thank you so much, Seol! This is an enormous help for me. I really appreciate it.

I'll let you know when I have tested the updated module.

hyunsooseol commented 1 year ago

Hi salmjoon

Update module to the jamovi library.

image

salmjoon commented 1 year ago

Hi Seol,

thank you! Now the class memberships get allocated to every single respondent! Thank you so much for fixing the module!

Only new thing that I spotted in the LCA results with the updated module was that the result values in "Residual df", "G² p" and "χ² p" are now "NaN". Before they had numeric values.

salmjoon commented 1 year ago

Do the "NaN" values result from the fixes done with the missing values?

hyunsooseol commented 1 year ago

Hi salmjoon

I added na.rm=FALSE option inside main function to get all membership. Since cases with missing values are retained, it is impossible to calculate "Residual df", "G² p" and "χ² p" in the poLCA R package.

Cheers Seol

salmjoon commented 1 year ago

Hi Seol,

okay, that seems logical. Anyhow the module works now very well with the missing values, so thank you again for your help!

All the best, salmjoon