Announcement

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

  • Sem with panel data

    hello everyone,
    I'm using SEM to solve my model. However, I still confuse cause my data is panel, and SEM just spend for time series. So, whether GSEM or SEM can use with panel data, and how can I indicate it through command with SEM or GSEM.
    Thank you very much!

  • #2
    It may not be exactly what you want, but you may want to look at the user-written xtdpdml. Among other things, it reshapes data from long to wide so that it can be used with sem. The support page is at

    https://www3.nd.edu/~rwilliam/dynamic/index.html

    Panel data make it possible both to control for unobserved confounders and to include lagged, endogenous regressors. Trying to do both at the same time, however, leads to serious estimation difficulties. In the econometric literature, these problems have been solved by using lagged instrumental variables together with the generalized method of moments (GMM). In Stata, commands such as xtabond and xtdpdsys have been used for these models. xtdpdml addresses the same problems via maximum likelihood estimation implemented with Stata's structural equation modeling (sem) command. The ML (sem) method is substantially more efficient than the GMM method when the normality assumption is met and suffers less from finite sample biases. xtdpdml greatly simplifies the SEM model specification process; makes it possible to test and relax many of the constraints that are typically embodied in dynamic panel models; unlike most related methods, allows for the inclusion of time-invariant variables in the model; takes advantage of Stata's ability to use full information maximum likelihood (FIML) for dealing with missing data; provides an overall goodness of fit measure by default and provides easy access to others; and can also generate code for use with Mplus.
    Although the emphasis is on dynamic models where lagged y affects y, you can get rid of the lagged effect, which makes xtdpdml more like xtreg.
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

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

    Comment


    • #3
      Originally posted by Richard Williams View Post
      It may not be exactly what you want, but you may want to look at the user-written xtdpdml. Among other things, it reshapes data from long to wide so that it can be used with sem. The support page is at

      https://www3.nd.edu/~rwilliam/dynamic/index.html



      Although the emphasis is on dynamic models where lagged y affects y, you can get rid of the lagged effect, which makes xtdpdml more like xtreg.
      I try to run it. However, I received this notice
      Data need to be in long format and xtset with
      both panelvar and timevar.
      If data are already in wide format use the wide option.
      Job is terminating.
      Can you help me explain and solve it.
      Thank you

      Comment


      • #4
        I don’t know what your data look like. But as the message says, the data should be in long format and xtset. If you aren’t clear what that means then read up on the xtset command. Or post an excerpt of your data using dataex as well as the commands you are running.
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        StataNow Version: 19.5 MP (2 processor)

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

        Comment


        • #5
          I want to discuss more about SEM with panel data. Can I ask u through email?
          Originally posted by Richard Williams View Post
          I don’t know what your data look like. But as the message says, the data should be in long format and xtset. If you aren’t clear what that means then read up on the xtset command. Or post an excerpt of your data using dataex as well as the commands you are running.

          Comment


          • #6



            Hi,




            I have a question regarding using mediation analysis in Stata, with panel data, in the format country year (128 countries for 16 years).




            Name of the variables ( Y - dependent variable; M- Mediator; X - Independent Variable)

            Y - v2x_polyarchy; M - l.v2xcs_ccsi; X - l.CSOdisbursementsSector150_pc







            sem (l.v2xcs_ccsi <- l.CSOdisbursementsSector150_pc l.CSOdisbAllSectorsexclgov_pc l.totaldisbursementsexclCSO_pc l.log_GDPpc l.v2clrspct l.conflict)(v2x_polyarchy <- l.v2xcs_ccsi l.CSOdisbursementsSector150_pc l.CSOdisbAllSectorsexclgov_pc l.totaldisbursementsexclCSO_pc l.log_GDPpc l.v2clrspct l.conflict), nocapslatent

            estat teffects










            Our question: Is it appropriate to use sem, with our panel data (country year? If not do you have any alternative options?







            However, we are getting weird results; we didnt expect that the direct effect is negative. Can you help us with interpretation?
            Mediator: Core Civil Society Index
            Total Effect Direct Effect Indirect Effect
            CSO democracy assistance p.c 0.005*

            (0.002)
            -0.005***

            (0.001)
            0.01***

            (0.002)[CHK1]


            Comment

            Working...
            X