I doing a LPA with one continuous variable X1. I need the class assignments and CPROBs for each record. I am able to get this using esti=mlr. But in esti=bayes am getting the below error.
*** WARNING in SAVEDATA command Class probabilities cannot be saved for ESTIMATOR=BAYES.
I tried a work-around of using save=fscores(10) and I get class proportions instead of cprob. ------ ---- ---- +C F10.3 C Proportion for Class 1 F10.3 C Proportion for Class 2 F10.3 C Proportion for Class 3 F10.3
+ variables that have a value for each of the 10 imputations ---- ------ ----- Is the C proportion same as CPROB please? Also I need the class assignments as well. Please advice. The reason I need class assignments and CPROB is to calculate the predicted value of my variable X1.
Dear Prof. Muthen. Thank you. I have sent you an email as advised.
Guido Biele posted on Tuesday, November 21, 2017 - 1:19 am
I would like to save or calculate class probabilities for each iteration in the context of a Bayesian mixture CFA/latent profile analysis.
It appears that save=fscores(10) will generate a sample of 10 class memberships using the posterior distribution. Could I exploit the fscores command to generate class memberships for each iteration by setting save=fscores(BITERATIONS) [not literally, just the number I set BITERATIONS to) to get group memberships for each iteration? If yes, would the 1st column of class member ships be calculated from the 1st iteration of the posterior, the 2nd class memberships from the second iteration, etc?
Also, could you point me to a paper where I could read up how to calculate class probabilities for each iteration given the model parameters?
Guido Biele posted on Wednesday, November 22, 2017 - 12:02 am
I tried using constraints, but got the error Messages "UNABLE TO GENERATE PARAMETERS SATISFYING THE CONSTRAINTS.".
Here is the relevant section of the Bayesian mixture CFA model with 4 latent groups:
... MODEL ! Bayesian CFA model with N(0,.01) priors for cross loadings %c#1% [F1*-2.5] (m1); [F2-F4*0]; %c#2% [F1*-1.5] (m2); [F2-F4*0]; %c#3% [F1*-0.5] (m3); [F2-F4*0]; MODEL CONSTRAINTS m3 < 0; ! factor mean of the last group is fixed at zero m2 < m3; m1 < m2; ...
Can you spot an error in this code?
What I have done now is that I specified priors with different means for the means of the first factor:
MODEL PRIORS: ... m1~N(-2.5,2); m2~N(-1.5,2); m3~N(-0.5,2);
which of course means that label switching can occur...
The constrain will work if the posteriors for m1,m2,m3 don't overlap much. If they do it won't work, so one would pick another set of constraints such as the mean for another factor that is more discriminating.
Label switching can occur but it doesn't occur often at all in my experience unless there is not a lot of information in the data about the latent classes. Using the tracelines it is very easy to spot label switching. I wouldn't worry about label switching unless it actually occurs. The model prior is a good idea as well. Also using ML estimator in parallel to the bayes estimation can be used as guidance for model constraint parameters.