Announcement

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

  • Cross-sectional and longitudinal association

    Hi everyone,
    I have longitudinal data whereby the outcome variable (marker of growth) was measured at 6 time points, one predictor (a bio-marker of a condition) at 3 time points and the other predictors only at baseline. I want to do a cross-sectional and longitudinal association between the change of the outcome variable and these predictors. I have been reading around, some have suggested mixed model (xtmixed) but i am not quite sure how to go about it in Stata. Hope this is clear.

    Thank you

  • #2
    Welcome to the Stata Forum/ Statalist,

    You may start by taking a look at - mixed - as well as - xtreg - commands.

    By the way, - xtmixed - has been replaced by - mixed - command.
    Best regards,

    Marcos

    Comment


    • #3
      Oscar:
      as an aside to Marcos' helpful hints, you would be better off with posting an excerpt/example of your dataset via -dataex- (type -search dataex- from within Stata to install it).
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        Thank you both for quick replies,

        I am going through - mixed - as well as - xtreg - commands. In the meantime here is an excerpt of my dataset
        Code:
        input int id str6 gender byte visit double agemo str1 fatherjob byte(siblings hhsize) double(marker haz hazdiff)
        1 "female" 1 6.3815789222717285 "Y" 0 3  .192872687704026               -1.54                    .
        1 "female" 2  6.842105388641357 "Y" 0 3                 .               -1.32    .2199999988079071
        1 "female" 3  7.763157844543457 "Y" 0 3                 .               -1.83   -.5099999904632568
        1 "female" 4  9.177631378173828 "Y" 0 3  .368248587570622                -.85    .9800000190734863
        1 "female" 5 10.526315689086914 "Y" 0 3                 .               -1.94   -1.090000033378601
        1 "female" 6   11.9078950881958 "Y" 0 3  .344302756067462               -1.51    .4300000071525574
        2 "female" 1  6.348684310913086 "Y" 0 3  .228967495219885 -3.0100000000000002                    .
        2 "female" 2  6.809210300445557 "Y" 0 3                 .               -2.86   .15000000596046448
        2 "female" 3 7.7302632331848145 "Y" 0 3                 . -2.5300000000000002   .33000001311302185
        2 "female" 4  9.111842155456543 "Y" 0 3  .824660103141116               -2.72   -.1899999976158142
        2 "female" 5 10.493420600891113 "Y" 0 3                 .               -2.61   .10999999940395355
        2 "female" 6             11.875 "Y" 0 3  .458734813573523               -2.24    .3700000047683716
        3 "female" 1  6.348684310913086 "Y" 1 2   .28099891422367               -1.96                    .
        3 "female" 2  6.809210300445557 "Y" 1 2                 .               -2.08  -.11999999731779099
        3 "female" 3 7.7302632331848145 "Y" 1 2                 . -2.2800000000000002  -.20000000298023224
        3 "female" 4  9.111842155456543 "Y" 1 2  .617267467734757               -2.39  -.10999999940395355
        3 "female" 5 10.493420600891113 "Y" 1 2                 .               -2.25   .14000000059604645
        3 "female" 6             11.875 "Y" 1 2  1.07555238774056               -2.35  -.10000000149011612
        4 "male"   1  6.348684310913086 "Y" 1 4  .142857142857143               -1.56                    .
        4 "male"   2  6.809210300445557 "Y" 1 4                 .               -1.51   .05000000074505806
        4 "male"   3 7.7302632331848145 "Y" 1 4                 .               -1.73   -.2199999988079071
        4 "male"   4  9.111842155456543 "Y" 1 4  .369108726084928               -1.16    .5699999928474426
        4 "male"   5 10.493420600891113 "Y" 1 4                 .               -1.17 -.009999999776482582
        4 "male"   6             11.875 "Y" 1 4 .0190604543704274                -.96   .20999999344348907
        6 "male"   1  5.789473533630371 "Y" 4 4  .234101382488479               -1.25                    .
        6 "male"   2               6.25 "Y" 4 4                 .               -1.49  -.23999999463558197
        6 "male"   3    7.1710524559021 "Y" 4 4                 .               -1.56  -.07000000029802322
        6 "male"   4  8.552631378173828 "Y" 4 4  .451018699413899               -1.73  -.17000000178813934
        6 "male"   5  9.934210777282715 "Y" 4 4                 .               -1.96  -.23000000417232513
        6 "male"   6 11.315789222717285 "Y" 4 4  .528267157507231               -2.31   -.3499999940395355
        end
        -hazdiff- (i.e. -haz- change from one visit to the other)is my outcome variable

        Oscar

        Comment


        • #5
          Hi again,
          I am calculating -hazdiff- (my outcome variable) using the following command:
          Code:
          sort id visit
          by id: gen hazdiff =haz-haz[_n-1]
          my question is how do I handle the missing value for visit 1 when fiting a mixed model. Do I have to drop visit 1?

          Oscar

          Comment

          Working...
          X