Good morning colleagues,

I'm having some trouble working out how to use margins and marginsplot to present bar charts for my Latent Class Analysis by Group.

My group LCA syntax is as follows:
Code:
gsem (Var1 Var2 Var3 Var4 Var5 Var6 <- _cons), family(bernoulli) link(logit) lclass(C 3) group(Var7) ginvariant(coef)
estat lcmean
estat lcprob
Previously, when I wasn't looking at this analysis by group, and just included Vars1-7 in a standard LCA, I used the below syntax to get the class probabilities charts and the individual class makeup, which was successful:

Code:
///Class probabilities chart
margins, predict(classpr class(1)) predict(classpr class(2))
marginsplot, recast(bar) xtitle("Latent Classes") ytitle("Probabilities of Belonging to a Class") xlabel(1 "Class 1" 2 "Class 2") title("Predicted Migraine Latent Class Probabilities with 95%CI")

///Class breakdown for class 1
margins, predict(outcome (Var1) class(1)) predict(outcome (Var2) class(1)) predict(outcome (Var3) class(1)) predict(outcome (Var4) class(1)) predict(outcome (Var5) class(1)) predict(outcome (Var6) class(1)) predict(outcome (Var7) class(1))
marginsplot, recast(bar) xtitle("") ytitle("") xlabel(1 "Var1" 2 "Var2" 3 "Var3" 4 "Var4" 5 "Var5" 6 "Var6" 7 "Var7") title ("Predicted Probability of Characteristics of Class 1")
However, I'm struggling to adapt the above code for margins and marginsplot to the group LCA, with a view to giving me the class probabilities for the classes within each binary group of Var7, and then the makeup of each of the classes within each group.

Any guidance would be greatly appreciated!

Kind regards,
Daniel Sullivan