Announcement

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

  • SEM - Time-dependent explanatory variable in latent growth model

    Hello,

    I am using the SEM procedure to build a latent growth model for longitudinal data (repeated variable = cog at times 0, 1, and 2).

    I am able to include baseline covariates (eg sex in the example below). I would like to include a time-dependent covariate Y measured at times 0, 1, and 2 and I do not seem to be able to make it work. Any advice ?

    sem ///
    (cog0 <- Intercept@1 Slope@0 _cons@0) ///
    (cog1 <- Intercept@1 Slope@1 _cons@0) ///
    (cog2 <- Intercept@1 Slope@2 _cons@0) ///
    (Intercept <- sex _cons) (Slope <- sex _cons ) , latent(Intercept Slope) ///
    var(e.cog0@var2 e.cog1@var2 e.cog2@var2) cov(e.Intercept*e.Slope ) ///

    Thank you

    André









  • #2
    You need to tell us what happens when you run this rather than just stating that you can't make it work. Please show your code along with the output you get including error messages. Also, the output will be a lot easier to read if you use code tags.
    Richard T. Campbell
    Emeritus Professor of Biostatistics and Sociology
    University of Illinois at Chicago

    Comment


    • #3
      It doesn't look like you have any time varying covariates in your syntax nor do you describe how they are supposed to fit into your model (e.g., do they directly effect the latent means, the manifest variables, are they autoregressive, etc...).

      Comment


      • #4
        Thank you. It's my first post, I will try to do better next time :-)

        The time-dependent variable Y is measured at the same time as COG at each time (0,1,2) and I would like Y to influence COG at each time, ie like in the model below. Y is not autoregressive.

        sem ///
        (cog0 <- Intercept@1 Slope@0 y0@a0 _cons@0) ///
        (cog1 <- Intercept@1 Slope@1 y1@a1 _cons@0) ///
        (cog2 <- Intercept@1 Slope@2 y2@a2 _cons@0) ///
        (Intercept <- sex _cons) (Slope <- sex _cons ) , ///
        latent(Intercept Slope) ///
        var(e.cog0@var2 e.cog1@var2 e.cog2@var2) cov(e.Intercept*e.Slope )

        With this syntax, the model fails to converge (Iteration 300: log likelihood = 115284.02 (not concave) and does not change so I need to stop it). I suppose I am doing something wrong as a mixed model using the same data converges without any difficulty.

        Thank you for your help.

        André






        Comment


        • #5
          Can you please provide the SEM output? I want to see how SEM interprets your model.
          Richard T. Campbell
          Emeritus Professor of Biostatistics and Sociology
          University of Illinois at Chicago

          Comment


          • #6
            Thank you Dick.

            The following model (without the time dependent time-variable Y; this model is a typical latent growth model as in the SEM documentation of Stata)

            Code:
            sem    (cog0 <- Intercept@1 Slope@0 _cons@0) ///
                      (cog1 <- Intercept@1 Slope@1 _cons@0) ///
                      (cog2 <- Intercept@1 Slope@2 _cons@0) ///
            (Intercept <- sex _cons) (Slope <- sex _cons ) , latent(Intercept Slope) ///
            var(e.cog0@var2 e.cog1@var2 e.cog2@var2) cov(e.Intercept*e.Slope )
            gives this output

            Code:
            Structural equation model                       Number of obs     =      2,521
            Estimation method  = ml
            Log likelihood     = -8578.3219
            
             ( 1)  [cog0]Intercept = 1
             ( 2)  [cog1]Intercept = 1
             ( 3)  [cog1]Slope = 1
             ( 4)  [cog2]Intercept = 1
             ( 5)  [cog2]Slope = 2
             ( 6)  [var(e.cog0)]_cons - [var(e.cog2)]_cons = 0
             ( 7)  [var(e.cog1)]_cons - [var(e.cog2)]_cons = 0
             ( 8)  [cog0]_cons = 0
             ( 9)  [cog1]_cons = 0
             (10)  [cog2]_cons = 0
            -----------------------------------------------------------------------------------------
                                    |                 OIM
                                    |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
            ------------------------+----------------------------------------------------------------
            Structural              |
              Intercept <-          |
                                sex |  -.1419539   .0292636    -4.85   0.000    -.1993094   -.0845983
                              _cons |   .3087704    .023284    13.26   0.000     .2631346    .3544062
              ----------------------+----------------------------------------------------------------
              Slope <-              |
                                sex |  -.0053852   .0134301    -0.40   0.688    -.0317078    .0209373
                              _cons |  -.1226473   .0106859   -11.48   0.000    -.1435912   -.1017034
            ------------------------+----------------------------------------------------------------
            Measurement             |
              cog0 <-               |
                          Intercept |          1  (constrained)
                              _cons |          0  (constrained)
              ----------------------+----------------------------------------------------------------
              cog1 <-               |
                          Intercept |          1  (constrained)
                              Slope |          1  (constrained)
                              _cons |          0  (constrained)
              ----------------------+----------------------------------------------------------------
              cog2 <-               |
                          Intercept |          1  (constrained)
                              Slope |          2  (constrained)
                              _cons |          0  (constrained)
            ------------------------+----------------------------------------------------------------
                         var(e.cog0)|   .1600242   .0045073                      .1514295    .1691066
                         var(e.cog1)|   .1600242   .0045073                      .1514295    .1691066
                         var(e.cog2)|   .1600242   .0045073                      .1514295    .1691066
                    var(e.Intercept)|   .3681304   .0146158                      .3405703    .3979209
                        var(e.Slope)|   .0256114   .0037322                      .0192482     .034078
            ------------------------+----------------------------------------------------------------
            cov(e.Intercept,e.Slope)|   .0065308   .0053133     1.23   0.219    -.0038831    .0169448
            -----------------------------------------------------------------------------------------
            LR test of model vs. saturated: chi2(4)   =     45.83, Prob > chi2 = 0.0000

            But the model that includes the time-dependent variable Y influencing COG at each time does not converge, so there is no output for me to show

            Code:
            sem ///
            (cog0 <- Intercept@1 Slope@0 y0@a0 _cons@0) ///
            (cog1 <- Intercept@1 Slope@1 y1@a1 _cons@0) ///
            (cog2 <- Intercept@1 Slope@2 y2@a2 _cons@0) ///
            (Intercept <- sex _cons) (Slope <- sex _cons ) , ///
            latent(Intercept Slope) ///
            var(e.cog0@var2 e.cog1@var2 e.cog2@var2) cov(e.Intercept*e.Slope )

            Thank you for your help

            Comment


            • #7
              Richard T. Campbell
              Emeritus Professor of Biostatistics and Sociology
              University of Illinois at Chicago

              Comment


              • #8
                Sorry, I just accidentally posted an empty note.

                You might want to take a look at Alan Acock's book, Discovering Structural Equation Modeling Using Stata. Chapter 4 of that book contains an example of exactly what you want to do. Here is his code setup.
                Code:
                use bmiworking.dta, clear   
                recode drkdays* (.a/.e=.)
                center drkdays* deswgt97
                
                /* This model cannot be fit in Small Stata */
                sem   (Intercept@1 Slope@0 c_drkdays01   -> bmi01) ///
                      (Intercept@1 Slope@1 c_drkdays02   -> bmi02) /// 
                      (Intercept@1 Slope@2 c_drkdays03   -> bmi03) ///                                                                     
                      (Intercept@1 Slope@4 c_drkdays05   -> bmi05) ///                                                                     
                      (Intercept@1 Slope@5 c_drkdays06   -> bmi06) ///                                                                     
                      (Intercept@1 Slope@6 c_drkdays07   -> bmi07) ///                                                                     
                      (Intercept@1 Slope@7 c_drkdays08   -> bmi08) ///
                      (Intercept@1 Slope@8 c_drkdays09   -> bmi09) ///
                      (Intercept Slope <- male c_deswgt _cons)           ///
                      if bmi01~=.|bmi02~=.|bmi03~=.|bmi05~=.|bmi06~=.|  ///
                      bmi07~=.|bmi08~=.|bmi09~=.,  ///         
                      cov(e.Intercept*e.Slope)  ///
                      method(mlmv) noconstant 
                estat eqgof
                estat gof, stats(all)
                estat mindices
                Looking at your code, it appears that you are having trouble relating the TVC's to the outcomes. In Acock's code you will note that each of the time varying bmi outcomes is predicted by the intercept, a time-coded slope value and a time-specific covariate, e.g. (Intercept@1 Slope@4 c_drkdays05 -> bmi05) /// I can't quite figure out the logic underlying your code, but I think if you base what you are trying to do on Acock's example you should be fine. I highly recommend his book.



                Richard T. Campbell
                Emeritus Professor of Biostatistics and Sociology
                University of Illinois at Chicago

                Comment


                • #9
                  Thank you very much Dick. This is very useful. It looks like this is what I am doing, but there must be a problem related to the data, as it fails to converge. I will try to run other examples. I ordered the book, it seems very useful.
                  Thanks for your help
                  André

                  Comment

                  Working...
                  X