Announcement

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

  • Gsem with dummy dependent variable

    Hello everyone,
    Now I'm working with gsem, my model have some problems, I hope that guys can help me solve this.
    My model is described as below. P, G1, G2, G is latent variables. convert is dummy dependent variable .
    I'm consider to write command to describe relationship between G1 G2 and G.
    I try to run : gsem ( convert <- F1- F5, logit) ( convert <- P G, logit) ( P-> p1 p2 p3 p4 p5) (G -> G1 G2) ( G1->ec1 ec2 ec3 ec4 ec5) (G2 -> h1 h2 h3 h4 h5 h6), latent (P G1 G2 G)
    but it cannot.

    T
    Click image for larger version

Name:	sem.png
Views:	1
Size:	102.8 KB
ID:	1470337


  • #2
    Quynh, it's best to show your code in the code delimiters (see my signature). This enables us to copy and paste each others' code.

    Your command is failing because by default, any variable which has a capitalized first letter is treated as a latent variable. I think you have observed indicators F1-F5, and Stata thinks these are latent. You can fix this:

    Code:
    gsem (convert <- F1- F5, logit) ( convert <- P G, logit) ( P-> p1 p2 p3 p4 p5) (G -> G1 G2) ( G1->ec1 ec2 ec3 ec4 ec5) (G2 -> h1 h2 h3 h4 h5 h6), ///
    nocapslatent latent (P G1 G2 G)
    If that still does not work, please present the exact error message you received.
    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


    • #3
      Yes, thank you. But my problem is it run continuously, don't have any result. If I point directly from G1 and G2 to convert, that's ok, but if have G it cannot show result.

      Comment


      • #4
        Originally posted by Quynh Nguyen View Post
        Yes, thank you. But my problem is it run continuously, don't have any result. If I point directly from G1 and G2 to convert, that's ok, but if have G it cannot show result.
        Then either the model is not identified, or one or two particular parameters are giving -gsem- difficulty with convergence. Read SEM intro 12 in your help files. You have a continuous latent variable, so ignore what it says about categorical latent variables.
        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


        • #5
          Generally you need to enforce a standard deviation on latent variables either by setting the connection to one of the observed variables to have a parameter of 1 or by constraining the standard deviation directly. Otherwise, the model is not identified since you can multiple/divide the connections to the latent variable and have equally good fits for different standard deviations on the latent variable.

          Comment


          • #6
            Here's another thought. Clearly, you think that G1 and G2 are related constructs. One way to represent that fact is to let G1 and G2 be linked to a higher-order factor, G. Clearly, either G is unidentifiable, or you are missing some constraints (and I don't know what those would be, because I don't fit this type of model).

            I'm no expert on identification, but SEM example 15 depicts a higher-order CFA, and the second-level latent variable has 4 latent variables under it. Two latent variables might not be enough to identify G. If others have fit this sort of structure, then see if you can find their path diagrams and model structures, then try to replicate what they constrained.

            Another plausible representation of the fact that G1 and G2 are related would be to allow them to be correlated. I think the default is that your latent variables are uncorrelated. If that's true, you should be able to add the option

            Code:
            gsem ... , covariance(G1*G2)
            , which should fit things as I described (i.e. G1 and G2 both are their own things, but Stata will now model a correlation between them, and they both separately affect the variable convert.
            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


            • #7
              Originally posted by Weiwen Ng View Post
              Here's another thought. Clearly, you think that G1 and G2 are related constructs. One way to represent that fact is to let G1 and G2 be linked to a higher-order factor, G. Clearly, either G is unidentifiable, or you are missing some constraints (and I don't know what those would be, because I don't fit this type of model).

              I'm no expert on identification, but SEM example 15 depicts a higher-order CFA, and the second-level latent variable has 4 latent variables under it. Two latent variables might not be enough to identify G. If others have fit this sort of structure, then see if you can find their path diagrams and model structures, then try to replicate what they constrained.

              Another plausible representation of the fact that G1 and G2 are related would be to allow them to be correlated. I think the default is that your latent variables are uncorrelated. If that's true, you should be able to add the option

              Code:
              gsem ... , covariance(G1*G2)
              , which should fit things as I described (i.e. G1 and G2 both are their own things, but Stata will now model a correlation between them, and they both separately affect the variable convert.
              Yeah, thank for your helping, I solved it. Do you know any test after GSEM? I read some test, but it just spend SEM model not GSEM such as: test good fit-nit , mindices...

              Comment


              • #8
                Originally posted by Quynh Nguyen View Post

                Yeah, thank for your helping, I solved it. Do you know any test after GSEM? I read some test, but it just spend SEM model not GSEM such as: test good fit-nit , mindices...
                As far as Im aware: There are no equivalent to tests for fit, like the Tucker-Lewis Index or the CFI (I forget what that stands for), or modification indices in generalized SEM. You can test nested models against one another using the standard likelihood ratio test, but you seem to be after an indicator of something like absolute fit. Your models for P, G1, and G2 are conceptually a lot like item response theory models. If you want to assess indicator loading on the associated latent trait, you could fit them as IRT models, and examine the discrimination parameters and perhaps the spread of the difficulty parameters.

                Generally, it's ideal to have item difficulty parameters covering the spread of the whole latent trait, although this may not be achievable. You also want each item to have adequate discrimination, generally at least 1 (I think). If you have Stata 14 or later, you can just fit the IRT model using, for example,

                Code:
                irt 2pl p1-p5
                However, if you only have Stata 13, then here's a bit of a secret: the IRT commands really just call on the generalized SEM command. You could also type:

                Code:
                gsem (P -> p1-p5, logit), variance(P@1)
                Now, you have to go and transform the coefficients to get the difficulty parameters. It's minus intercept divided by slope. The slope is the discrimination parameter. You can do this manually, or you can use the -nlcom- command. You may not need to care so much about the difficulty parameters, and you could just focus on the discrimination parameters (i.e. the slopes or loadings). I'd advise you to go and do some substantive reading on IRT if you absolutely must have some indicator of absolute fit for the model.
                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

                Working...
                X