Announcement

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

  • -xtdpdml- with interaction term

    Hi Stata Experts:

    I would to use -xtdpdml- to estimate dynamic panel cross-lagged model.

    My model is Y(t)=aY(t-1)+bX(t-1)+cX(t-1)*A+dZ(t)+error term(t)

    My main interest variable is interaction term between X(t-1) and A. Both X and A are categorical variables, with 18 categories.

    May I know whether -xtdpdml- can accommodate interaction term like this? and how to code this categorical variable? may I directly use i.X##i.A? If not, could you please give a brief example how to code this interaction term in -xtdpdml-?

    Thanks

    Connie

  • #2
    xtdpdml is a shell for sem, and sem does not support factor variables. See the help file for handling interactions with time (xfree and yfree options). For other interactions you need to compute them yourself.

    Are you saying that both X and A have 18 categories, and that you therefore want to include around 300 interactions? If so, I doubt there is any way xtdpdml could handle that many variables. In fact I think most methods would have a terrible time. Can you greatly reduce the number of categories?
    -------------------------------------------
    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
      Thank you, Richard. I mean the interaction term has 18 categories in total.

      Comment


      • #4
        I suspect 18 will be too much, especially when you consider that there will basically be a set of variables for each time period. You can try it, but it won't surprise me if you have problems. xtdpdml works best with large N, small T (10 or less preferably). Large T or a lot of independent variables can cause it to choke.

        The xtdpdml support page 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://www3.nd.edu/~rwilliam

        Comment


        • #5
          You are right, Richard. I changed the interaction term into binary variables. As there are many factor variables in my data, I just consider some as continuous and dummy the others. My code for -xtdpdml- is
          Code:
          xtdpdml lfstfy age Rmarital Ghealth1 disease cfreq healthstress moneystress, pre(L.WA3) constinv errorinv fiml vce(robust)
          . It takes more than half an hour to run it, but still without any results. I do not know whether it is because coverage issue. I also tried to reduce the number of independent variables, which seems not improving the situation. Instead, I manually create sem code.
          The code is
          Code:
          sem (lfstfy2<-lfstfy1@b1 WA21@b2 age2@b3 Ghealth12@b4 disease2@b5 cfreq2@b6 healthstress2@b7 moneystress2@b8 Alpha@1 E2@1)(lfstfy3<-lfstfy2@b1 WA22@b2 age3@b3 Ghealth13@b4 disease3@b5 cfreq3@b6 healthstress3@b7 moneystress3@b8 Alpha@1 E3@1)(lfstfy4<-lfstfy3@b1 WA23@b2 age4@b3 Ghealth14@b4 disease4@b5 cfreq4@b6 healthstress4@b7 moneystress4@b8 Alpha@1 E4@1)(lfstfy5<-lfstfy4@b1 WA24@b2 age5@b3 Ghealth15@b4 disease5@b5 cfreq5@b6 healthstress5@b7 moneystress5@b8 Alpha@1 E5@1)(lfstfy6<-lfstfy5@b1 WA25@b2 age6@b3 Ghealth16@b4 disease6@b5 cfreq6@b6 healthstress6@b7 moneystress6@b8 Alpha@1), var(e.lfstfy2@0  e.lfstfy3@0 e.lfstfy4@0 e.lfstfy5@0 e.lfstfy6@0) var(Alpha)cov(Alpha*(E2 E3 E4 E5)@0) cov(_OEx*(E2 E3 E4 E5)@0) cov(E2*(E3 E4 E5)@0) cov(E3*(E4 E5)@0) cov(E4*E5@0) cov(WA23*(E2)) cov(WA24*(E2 E3)) cov(WA25*(E2 E3 E4)) iterate(250) technique(nr 25 bhhh 25) noxconditional latent(Alpha E2 E3 E4 E5) method(mlmv)
          .
          However, It shows "initial values not feasible".

          I am wondering whether my data is suitable for lagged cross panel, though I really knee to use it. Any suggestions?

          Thanks,

          Connie

          Comment


          • #6
            All observed variable names should start with lowercase letters. Otherwise sem thinks they are latent variables. So the first thing I would do is rename Rmarital and Ghealth1 and WA3. This is mentioned in the help but people often miss it. This mistake alone will keep your model from running (although once you fix it, other problems may show up).

            What are N and T with your data set?

            The help file has a section on convergence problems.

            If you still have problems my generic advice is to start with a very simple model and gradually add variables to it.
            -------------------------------------------
            Richard Williams, Notre Dame Dept of Sociology
            StataNow Version: 19.5 MP (2 processor)

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

            Comment

            Working...
            X