Announcement

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

  • SEM Model - Testing for different Groups

    Dear Stata Forum,

    I'm currently working on a SEM model which is a quite new field to me. However I managed to implement the following model successfully (The results are in line with other literature in my field, they are also economicaly intuitivly):

    Code:
       
                   constraint 1  -[repsonse1]predictor1                     -[repsonse2]predictor1                      +[repsonse3]predictor1               =1
                   constraint 2  -[repsonse1]predictor2                     -[repsonse2]predictor2                      +[repsonse3]predictor2               =0
                   constraint 3  -[repsonse1]predictor3                     -[repsonse2]predictor3                      +[repsonse3]predictor3               =0
                   constraint 4  -[repsonse1]lagged_response1         -[repsonse2]lagged_response1          +[repsonse3]lagged_response1   =0
                   constraint 5  -[repsonse1]lagged_response2         -[repsonse2]lagged_response2          +[repsonse3]lagged_response2   =0
                   constraint 6  -[repsonse1]lagged_response3         -[repsonse2]lagged_response3          +[repsonse3]lagged_response3   =0
                   global constraints     "1 2 3 4 5 6"
        
               gsem                    (repsonse1     <- predictor1 predictor2 predictor3  lagged_response1 lagged_response2 lagged_response3)/*
                                      */   (repsonse2   <- predictor1 predictor2 predictor3  lagged_response1 lagged_response2 lagged_response3)/*
                                      */   (repsonse3   <- predictor1 predictor2 predictor3  lagged_response1 lagged_response2 lagged_response3)/*
                                      */  , nocapslatent vce(cid)    const( 1 2 3 4 5 6 )
    So far everyting works out - I also tried the sem command (which yields comparable results).

    However I now want to:
    1) Estimate exactly this model for two groups of individuals in my sample, coded as a binary variable (0/1) and
    2) Do a T-Test if predictor1 is different for both groups in regard to repsonse1, repsonse2 and response3

    My questions:
    1) Is there any possibility to do this via a sample split? If yes how? My idea is to save coefficients and standard errors and then use it later in "test". However so far I was not able to figure out a way to do this?
    2) I tried to use the gsem ability of including factor variables (like in a single equation model as interaction term), however the results where completly strange and I guess I did not implement it properly. How do I implement the use of factor variables in my model and then use it in a test of different coefficients?


    Thanks a lot for your help!

    kind regards,

    Johann




  • #2
    Hello Johann,

    You may wish to add the - group() - option.

    Also, here in the Stata Manual, particular on page 539 and beyond, you will find examples of using group comparison under SEM.

    Hopefully that helps.
    Best regards,

    Marcos

    Comment


    • #3
      Dear Marcos,

      many thanks for your answer. I already tried the group( ) option of the sem command. However I get totaly different coefficients then in an estimation via sample split. My questions therefore are: What does the group( ) option acutaly do? Does it do a sample split ? Are the groups within the estimation are related somehow? Why do I obtain different coefficients?

      Many thanks again for your help!

      kind regards,

      Johann

      Comment


      • #4
        With regards to the questions in #3, I wish to display an excerpt from the same link I shared in #2:

        [...generally speaking, when we specify group(groupvar), the measurement part of the model is constrained
        by default to be the same across the groups, whereas the remaining parts will have separate
        parameters for each group.
        You may also wish to read beyond page 264.

        Hopefully that helps.
        Best regards,

        Marcos

        Comment


        • #5
          Dear Marcos,

          many thanks again for your answer. So what if I want to have all parts of the model to be the same across the both groups and not only the measurement part of the model constrained?

          regards,

          Johannes

          Comment


          • #6
            Hello Johann,

            I fear I'm not understanding well the reason to do so. I guess you may face obstacles concerning SEM's theoretical background as well. Personally,I have never had a similar situation, in terms of envisaging a rationale to select such constraints. Hopefully you will get advice from fellows with more expertise. That said, and just speculating, you will always have the "power" (or "gift"?) to select a vast array of (mixed blessing) constraints for structural equation models in Stata. By the way, I see in #1 that you have already selected a whole bunch of constraints
            Best regards,

            Marcos

            Comment


            • #7
              Dear Marcos,

              many thanks for your answer. I guess the sem group() option might then not what I need. Refering to my initial goal: The only thing I want to do is to estimate this model for my two groups (with all constraints) and then test whether the coeffcients for predictor1 is different in my two groups. I did some further research and now I see two possible solutions:

              a) Bootstrap the estimation and save the coefficients and standard errors, then perform a (parametric) t-test (calculation of the t-value by hand e.g. via excel). My question therefore is: How do I save coefficients and espcially standard errors after the estimation bootstrapping of gsem/sem? Is there also a possibility to save coefficients after each (!) bootstrap run?

              b) Do the estimation and perform a permuteration test. Problem here is that I did not find anything on how to perform a permutation test in stata.

              regards,

              Johann

              Comment


              • #8
                Dear Stata Forum,

                In the mean time if found a solution to my problem. As someone might experience a similar problem or question, here is what I did:

                1. Estimated my model as described in my first post, seperately for my two sub groups appling a bootstrap with x iterations. This is where I obtained coefficients and bootstraped standard errors
                2. Used the coefficients and bootstrapped standard errors within a t-test formular (manually) in excel, to test for significant differences in my coefficients. The Excel formular is somehow tricky to apply in excel

                There might be a away to do this in Stata which I don't know but this way also works fine for me.

                regards,

                Johann

                Comment


                • #9
                  Hello there ! I have a problem similar to the one Johann had. I am trying to run the same SEM model on two different groups using the -group () command. The model does not concave. However when I run the models differently using -if, they run fairly good. Does anyone know why ? I am guessing this has to do with the group() command and how it samples(?) /estimates!?

                  Is it justified to compare the coefficient estimates etc. based on the two separate models like Johann did ?

                  Regards

                  George.

                  Comment

                  Working...
                  X