Announcement

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

  • Multi-group latent class analysis question

    Hi
    I am trying to build a semi-constrained model holding item-response probabilities but allowing class proportions vary between groups in a multi-group latent class analysis. How can I use the -group- option to do this?

    Also, the discussion in this post is helpful https://www.statalist.org/forums/for...ass-regression, I followed the code posted for measurement invariance test

    ​​​​​​​
    Code:
    gsem (a1 a2 a3 a4 a5 s6 a7 a8 <-), mlogit lclass(C 3)
    estat lcmean
    estat lcprob
    estimates store c31
    
    gsem (a1 a2 a3 a4 a5 s6 a7 a8 <-), mlogit lclass(C 3) group(male) byparm ginvariant(coef loading)
    estat lcmean
    estat lcprob
    estimates store c32
    
    estimates stats c21 c32
    test _b[3.C:1.male] = _b[3.C:2.male]
    test _b[a1:1.male#3.C] = _b[a1:2.male#3.C]
    ​​​​​​​test _b[a2:1.male#3.C] = _b[a2:2.male#3.C]
    The first test worked well but from the second one testing the mean of each item, it showed "equation a1 not found r(111)". I cannot find the problem here. a1-a8 are 3-class ordinal variables (range:1-3).

    Thank you!

  • #2
    I found why the test function did not work, as my variables are not dummy, the right code is:
    test _b[3.a1:1.male#3.C] = _b[3.a1:2.male#3.C]
    I have a follow up question that for a three-latent-class model, when testing for the measurement invariance, should I test both the 2.C and 3.C? Like:
    Code:
    test _b[3.C:1.male] = _b[3.C:2.male]
    test _b[2.C:1.male] = _b[2.C:2.male]
    test _b[3.a1:1.male#3.C] = _b[3.a1:2.male#3.C]
    test _b[3.a1:1.male#2.C] = _b[3.a1:2.male#2.C]
    Thank you!

    Comment


    • #3
      Originally posted by Lushen Li View Post
      Hi
      I am trying to build a semi-constrained model holding item-response probabilities but allowing class proportions vary between groups in a multi-group latent class analysis. How can I use the -group- option to do this?

      Also, the discussion in this post is helpful https://www.statalist.org/forums/for...ass-regression, I followed the code posted for measurement invariance test

      Code:
      gsem (a1 a2 a3 a4 a5 s6 a7 a8 &lt;-), mlogit lclass(C 3)
      estat lcmean
      estat lcprob
      estimates store c31
      
      gsem (a1 a2 a3 a4 a5 s6 a7 a8 &lt;-), mlogit lclass(C 3) group(male) byparm ginvariant(coef loading)
      estat lcmean
      estat lcprob
      estimates store c32
      
      estimates stats c21 c32
      test _b[3.C:1.male] = _b[3.C:2.male]
      test _b[a1:1.male#3.C] = _b[a1:2.male#3.C]
      ​​​​​​​test _b[a2:1.male#3.C] = _b[a2:2.male#3.C]
      The first test worked well but from the second one testing the mean of each item, it showed "equation a1 not found r(111)". I cannot find the problem here. a1-a8 are 3-class ordinal variables (range:1-3).

      Thank you!
      Lushen,

      One quick note, you say that your items are ordered categorical, but you asked Stata to use a multinomial (i.e. unordered) model to estimate the classes. Was this intentional?

      I can't see your data, but it may relate to your initial problem with syntax. In the example in the link you found, I illustrated the case using binary items and a logit model. With a multinomial or ordered logit model, the equation names and coefficients may be named differently. Try typing this:

      Code:
      estimates restore c32
      gsem, byparm coeflegend
      That gives you the symbolic names for all the coefficients in the model.

      I can think of a couple of ways to argue for measurement invariance. One, if you fit a model with the parameters constrained equal between groups, then a model with parameters unconstrained, you get 2 BIC values to compare (lower is better). Basically, if the constrained model's BIC is lower, then the model assuming measurement invariance fits the data better.

      Two, if you want to do this with Wald tests, then I think I would rather do a joint test, e.g.

      Code:
      test _b[3.a1:1.male#3.C] = _b[3.a1:2.male#3.C], notest accum
      test _b[3.a1:1.male#2.C] = _b[3.a1:2.male#2.C], accum
      That said, testing measurement invariance is something I am less familiar with. I'm not fully versed in the SEM world, where these sort of concepts originate.
      Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

      When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

      Comment


      • #4
        Hello,

        I have searched multiple threads on testing group invariance in LCA using Stata for the last few weeks(and have posted questions myself), and this is one of the more helpful threads I have come across. However, I still have some questions. Here is my issue.

        1. I am running a mimic model with 5 binary indicators named: hsgpa30, aca, select, colgpa, highdeg. I have 7 covariates, though I am not concerned with their impacts on the indicators, only that they help improve model fit.
        2. I have a settled on a 3 class solution. I want to know if the item probabilities vary by race within each class.

        Here is my code.

        Code:
         gsem (hsgpa30 aca select colgpa highdeg <- _cons) (c <- ses m20 e20 b51 b82 b79 lang fl), family(bernoulli) link(logit) lclass(c 3) group(race_1) byparm ginvariant(
        > cons coef loading) startvalues(randomid, draws(5) seed(15))
        3. I understand that to start testing for nonuniform DIF, I would of course begin with a null model, where in the previously cited code it would be gininvaraint ().
        4. I think Stata posted my model names as part of the output from the code I show here. For example, I get:


        ( 1) [2.c]0bn.race_1 - [2.c]1.race_1 = 0
        ( 2) [3.c]0bn.race_1 - [3.c]1.race_1 = 0
        ( 3) [hsgpa30]0bn.race_1#1bn.c - [hsgpa30]1.race_1#1bn.c = 0
        ( 4) [aca]0bn.race_1#1bn.c - [aca]1.race_1#1bn.c = 0
        ( 5) [select]0bn.race_1#1bn.c - [select]1.race_1#1bn.c = 0
        ( 6) [colgpa]0bn.race_1#1bn.c - [colgpa]1.race_1#1bn.c = 0
        ( 7) [highdeg]0bn.race_1#1bn.c - [highdeg]1.race_1#1bn.c = 0



        5. But I am running into problems with my syntax in trying to test item invariance. For example, how would I test whether hsgpa30 is invariant by race within class 1, class 2, etc? Would it be something like:
        Code:
        test _b[1.hsgpa30:1.race_1#1.c] = _b[1.hsgpa:0.race_1#1.c]
        I think I am struggling with understanding where all of the various tags (group name, item name, and derived lca class name) go in the code.

        I would appreciate any help with this syntax.

        Comment

        Working...
        X