Announcement

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

  • Convergence in GSEM

    Hello everyone,

    I am trying to run a CFA of two factors (L1 and L2).

    L1 and L2 are the latent variables and g1 - g11 and p1 - p17 that are binary coded 0 and 1.

    Code:

    Code:
     gsem (L1 <- g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 g11, family(bernoulli) link(logit)) (L2 <- p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17, family(bernoulli) link(logit)),covstruct(_lexogenous, diagonal) group() latent(L1 L2) cov(L1*L2) nocapslatent
    However, after entering the syntax above, I am unable to get the model to converge (it endlessly iterates). I am not sure what the issue is, so I would really appreciate some input on how to correct it.

    I also attempted to run the model after removing items with a low prevalence (less than 5% are '1's) in the dataset but still had the same issue.

    Thank you in advance!

  • #2
    I think your problem is that you have the arrow reversed. The latent variables L1 and L2 should predict the observed responses. You have the observed responses predicting the unobserved latent variables.
    Code:
    gsem (L1 -> g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 g11, family(bernoulli) link(logit)) ///
    (L2 -> p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17, family(bernoulli) link(logit)), ///
    covstruct(_lexogenous, diagonal) group() latent(L1 L2) cov(L1*L2)

    Comment


    • #3
      Erik Ruzek Thank you for your response. However, I got an error when using your suggested code.

      Code:
      gsem (L1 <- g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 g11, family(bernoulli) link(logit)) ///
      (L2 <- p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17, family(bernoulli) link(logit)), ///
      covstruct(_lexogenous, diagonal) group() latent(L1 L2) cov(L1*L2) nocapslatent
      Code:
      # Output: ///
      note: Latent variable L1 was specified with option family(bernoulli), but family(gaussian) is the only option allowed. Assuming family(gaussian) for L1. ///
      note: Latent variable L1 was specified with option link(logit), but link(identity) is the only option allowed. Assuming (identity) for L1. ///
      note: Latent variable L2 was specified with option family(bernoulli), but family(gaussian) is the only option allowed. Assuming family(gaussian) for L2. ///
      note: Latent variable L2 was specified with option link(logit), but link(identity) is the only option allowed. Assuming (identity) for L2. ///
      model not identified; ///
      no paths from latent variable L1 to observed variables

      Comment


      • #4
        Originally posted by Erica Fong View Post
        . . . I got an error when using your suggested code.

        Code:
        gsem (L1 <- g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 g11, family(bernoulli) link(logit)) ///
        (L2 <- p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17, family(bernoulli) link(logit)), ///
        covstruct(_lexogenous, diagonal) group() latent(L1 L2) cov(L1*L2) nocapslatent
        A few observations:

        1. You aren't using Eric's suggested code: you didn't reverse the arrows.

        2. What's group() doing there?

        3. Why do you first force the latent factors to have diagonal (no covariance) covariance structure and then turn around and specify a covariance between L1 and L2?

        4. You don't need the latent(L1 L2) nocapslatent options; they don't do anything in your command.

        Comment


        • #5
          Thanks for your response.

          Apologies for the confusion, I did use Eric's code and got the output stated above. I copied and pasted the code from my original post but forgot to change the direction of the arrows.

          I have also attempted to run the code using your suggestions, but the output was still the same as when they were in it.
          Code:
          gsem (L1 <- g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 g11, family(bernoulli) link(logit)) /// 
           (L2 <- p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17, family(bernoulli) link(logit)), cov(L1*L2)

          Comment


          • #6
            Originally posted by Erica Fong View Post
            I have also attempted to run the code using your suggestions, but the output was still the same as when they were in it.
            Code:
            gsem (L1 <- g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 g11, family(bernoulli) link(logit)) ///
            (L2 <- p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17, family(bernoulli) link(logit)), cov(L1*L2)
            You're almost there.

            What you've got is this:
            Code:
            gsem (L1 <- g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 g11, family(bernoulli) link(logit)) ///
            (L2 <- p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17, family(bernoulli) link(logit)), cov(L1*L2)
            What you need is instead this:
            Code:
            gsem (L1 -> g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 g11, family(bernoulli) link(logit)) ///
            (L2 -> p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17, family(bernoulli) link(logit))
            Just remember, for CFAs the arrows should be emanating from the latent factors to the manifest indicator variables.

            (You also don't need to specify the covariance between the latent factors in this case; Stata will automatically include that covariance term unless you specify otherwise.)

            Comment


            • #7
              My guess is that Eric and Joseph have identified the problem. But, if problems persist, some generic suggestions for dealing with convergence problems are at

              https://www3.nd.edu/~rwilliam/xsoc73994/L02.pdf
              -------------------------------------------
              Richard Williams, Notre Dame Dept of Sociology
              StataNow Version: 19.5 MP (2 processor)

              EMAIL: [email protected]
              WWW: https://academicweb.nd.edu/~rwilliam/

              Comment

              Working...
              X