Announcement

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

  • Can xtdpdml be used when T = 2 ?

    I'm trying to incorporate a fixed effects-analysis into a SEM framework using xtdpdml.

    A simplified extract of my code is:

    Code:
    xtset id year
    xtdpdml score partic, tfix
    However, I receive error codes such as "T value is too small given the lags specified. For example if xlag = 2 then T must equal at least 4"

    Adding the ylag(0) option does not change this.

    I found other users mentioning that xtdpdml might not work for datasets with T = 2, see:
    https://www.statalist.org/forums/for...e-is-too-small
    https://www.statalist.org/forums/for...on-models-2009

    Is that correct, or is there a way to incorporate a fixed effects-analysis with T = 2 into a SEM framework?

  • #2
    The answer to your original question is evident -- the command told you how many periods you need to implement it.

    But what is "fixed effects-analysis into a SEM framework"?

    If you explain what you want to do, somebody might be able to tell you how to do it.

    Comment


    • #3
      It has been a while since I wrote xtdpdml, so hopefully I can still get this right.

      1. T can equal 2 if ylag = 0 AND none of the other variables in the model are lagged. Example:

      Code:
      use https://www3.nd.edu/~rwilliam/statafiles/wages, clear
      xtset id t
      keep if t<3
      xtdpdml wks lwage, inv(ed) pre(union) ylag(0)
      If Daniel specifies ylag(0) and still gets the T is too small error message, I bet it is because he has one or more lagged Xs in his model. If that is NOT the case, I would like to see his code and output.

      2. In general, T must be at least equal to 2 + maximum # of lags. By default, ylag = 1 so T must be at at least 3 if default settings are used.

      As to why that is -- you need at least 2 time periods to estimate fixed effects for variables not in the model. If T = 2 and Ylag = 1, then you actually only have one time period, for Y time 2, the equation for which includes Y time 1 as an independent variable. You don't have an equation for Y time 1 because there is no Y time 0 to use as a lagged independent variable.

      In short, if T = 2, you cannot have any lagged Y or X variables if you want to use xtdpdml. With a strongly balanced panel, no missing data, no lagged Xs, and no effect of lagged y, xtdpdml produces results that are almost identical to xtreg -- so you may just want to use xtreg in such situations. But if there are missing data, the fiml option may make xtdpdml the better option.

      For those who have no idea what xtdpdml is, you can see the SJ article on it at

      https://journals.sagepub.com/doi/pdf...867X1801800201

      The support page for xtdpdml is at

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

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

      Comment


      • #4
        Thank you Richard for the informative reply!

        I got it working now.

        Considering that I use a dataset with T = 2 and no lags, I find that a first-difference application should produce the same results (the application of the first-differences estimator in a SEM framework is discussed in this thread: https://www.statalist.org/forums/for...he-sem-command).

        The support page for xtdpdml (https://www3.nd.edu/~rwilliam/dynamic/index.html) lists very informative texts on fixed effects SEM models. Do you know if there are texts discussing fixed effects SEM models which:
        1) include latent variables based on several observed variables?
        2) include indirect relationships (path analysis/mediation)?
        Last edited by Daniel Lindgren; 29 May 2022, 14:25.

        Comment


        • #5
          My guess is that it is possible to do something along the lines you want. Coding, however, might be tedious and error-prone. Indeed, we wrote xtdpdml because hand-coding was so difficult.

          xtdpdml does include an option to output the Stata code that it creates. You might have it do so, and then figure out how to modify it to do what you want, e.g. have multiple-indicator latent variables. Be patient and careful, because I think it will probably take a while to get it right, if you can do it at all.

          You might consider some compromises, such as using factor analysis beforehand to create measures of the latent variables you are interested in.
          -------------------------------------------
          Richard Williams, Notre Dame Dept of Sociology
          StataNow Version: 19.5 MP (2 processor)

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

          Comment


          • #6
            Thank you, I'll try some more work on this!

            Comment


            • #7
              A little update:

              Because T = 2 in my dataset, I reckoned that a way to simplify estimations would be to difference all variables in a wide dataset and thereafter use the differenced variables in the sem-framework.

              Thereby, all estimations can be performed without parallell equations, which simplifies the process and also means that normal goodness-of-fit-statistics can be used.

              I haven't read about this solution anywhere, but it seems to yield identical results as a first-difference sem with parallell equations.

              Comment

              Working...
              X