Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to constrain specific error variances within class, using Finite Mixture Modelling (fmm command)

    Hello, I am using fmm to get predicted values the outcome (d2). My outcome variable is on a discrete scale between 0 and 8 and has a mixed distribution. I am having problems with model convergence, which I believe is due to the very small error variance of d2 within one of the classes. I am looking for advice on how to constrain the error variance within a specific class.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(r x1_2 x2_2 x3_2 x4_2 ed2 ec2 et d2)
    0 -.3962013   .26979256    .3281854    .2020966  -4.657156  -.4733167   .2078566 0
    0 .05005939     -.59324 -.035069607    .3325345   5.433654  -.4342205   .1410909 8
    0 -.3335885   .37892455   -.2006014  -1.0529058  1.7499243  -.4042091 -1.1582466 8
    1 .11571763   -.7092105  -1.0071937 -.011563746   .6332693  -.3538966   1.378718 3
    1  -.246939 -.011524091    .4544793   -.3270597 -.02334997  -.3515592  -1.380565 5
    1 .03066246    .8050294    .6015989   .04351863  -8.610477  -.3318292  1.2506913 0
    1 -.3075792  -.22870398    .3874406   -.3271127   4.626868  -.3284605   .1642472 8
    1 -.4148459   .26754683    .9080259    .4345325 -4.2743464  -.3278946  .27396873 0
    1 .57738924   -.2995521  -.20666783   .09813257   7.067642  -.3191804   .5206774 8
    0 -1.064182    .7120976  -.17886953  -.17023326  -5.653436 -.31534675 -1.6717683 0
    end

    When using the fmm command, the model does not converge and I believe this is due to the error variance of d2 in Class 2 being too small to estimate.
    Code:
    fmm 2,startvalues(randomid, draws(5) seed(15)): regress d2 x1_2 x2_2 x3_2 x4_2
    If I constrain the variance of both the classes to be the same, the model converges but predicts poorly and underestimates the error variance of d2 in Class 1.
    Code:
    fmm 2,startvalues(randomid, draws(5) seed(15)) var(e.d2@a): regress d2 x1_2 x2_2 x3_2 x4_2
    I have tried writing constraints but I cannot seem to write the code to target this parameter. Any help with how I can properly code this would be much appreciated!
    Code:
    constraint 1 var[(e.d2)#2.Class] = 0.01
    fmm 2,startvalues(randomid, draws(5) seed(15)): regress d2 x1_2 x2_2 x3_2 x4_2
    Thank you
    Last edited by Mollie Paynee; 07 Dec 2023, 07:24. Reason: Adding tags

  • #2
    I don't have the time to get into the details, but I suggest you consider running your model via gsem instead of fmm. You have a lot of control over model parameters in gsem, which is the underlying engine of fmm as far as I can tell.

    Comment


    • #3
      Thanks Erik! I have tried with gsem!

      Edit: Although gsem converges, the error variances within classes are automatically constrained to be equal. This brings me back to the original question but applied to gsem on how to edit error variances of outcomes within class.
      Last edited by Mollie Paynee; 07 Dec 2023, 12:45.

      Comment

      Working...
      X