Announcement

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

  • Repeated measures

    Hi
    I have longitudinal data. I used "xtreg variable i.age" in Stata 14.0. I get regression coefficients for each age. Does the regression output reflect the changes for every year from a single baseline time point (the time of 1st measurement) or does it reflect the year on year changes? I would like the coefficients for the year on year changes.

  • #2
    Ansuyah:
    I'm not clear with the way you -xtset- your data, first, nor you report whether a -hausman- test for performed.
    Yiour query seems to focus on the different flavours of within and between variance.
    Could you please provide an excerpt/example of your data via -dataex- (type -search dataex- from within Stata to intall it).
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      It reflects the changes from the baseline. For year-on-year changes, use
      Code:
      contrast ar.age, nowald
      after fitting the model.

      Comment


      • #4
        Thank you for your feedback Joseph and Carlo
        Below is a sample of my data
        I have successfully done R anova for "bone" against "age" and obtained contrasts.

        apv is a biological age scale that was used for each individual.
        ypv was calculated from apv as a continuous variable. For repeated measures a categorical variable ypvcat was generated. Stata does not handle negative numbers for repeated measures, so ypvage was generated. For some "ypvage" there are duplicates which I do not want to drop. This is related to the way in which the categories were defined.
        Because of the duplicates I could not do an R anova.
        I did the following:
        xtset data
        xtreg bone i.ypvage, cluster(Id)
        contrast ar.ypvage works only if I use i.ypvage
        The regression coefficients I obtained for each ypvage I presume are for each year against the baseline year as opposed to year on year. The data has been analysed longitudinally using "ypv" to give me an overall slope.
        I would like to compare the annual changes in the growth of the bone against ypvage.


        Code:
        id  age apv ypv  ypvcat ypvage bone
        104 12 12.65   .27  0  7  9.53
        104 13 12.65  1.28  1  8  9.91
        104 14 12.65  2.32  2  9 10.66
        104 15 12.65  3.25  3 10 10.71
        105 10 12.83 -2.71 -2  5  8.23
        105 11 12.83 -1.45 -1  6  8.74
        105 12 12.83  -.33  0  7  9.34
        105 13 12.83   .65  0  7  9.66
        105 15 12.83  2.31  2  9 10.13
        105 16 12.83  3.29  3 10  9.91

        Comment


        • #5
          Originally posted by Ansuyah Magan View Post
          I would like to compare the annual changes in the growth of the bone against ypvage.
          Code:
          anova bone id ypvage
          contrast ar.ypvage
          or
          Code:
          xtset id
          xtreg bone i.ypvage, fe
          contrast ar.ypvage

          Comment


          • #6
            My output after xtreg bone i.ypage, fe

            Does the coefficient for ypvage 4 represent the slope between data ypvage 1-4 or between ypvage 3-4?
            ypvage coeff SE
            2 0.08 0.12
            3 0.27 0.12
            4 0.45 0.11
            5 0.70 0.11

            Comment


            • #7
              Originally posted by Ansuyah Magan View Post
              Does the coefficient for ypvage 4 represent the slope between data ypvage 1-4 or between ypvage 3-4?
              Well, you could
              Code:
              table ypage, contents(mean bone)
              and answer your own question by inspection, but it might be more profitable in the long run to
              Code:
              help factor variables
              because Stata's factor variables have some flexibility that might come in handy in the future, and it would be good to get to know them better.

              Comment


              • #8
                Ansuyah:
                - 0.45 represents the difference between 4 and the reference category (1, in your case);
                - the difference between 4 and 3 is: (0.45-0.27)=0.18.

                PS: crossed in the cyberspace with Joseph's more helpful reply.
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment


                • #9
                  Thank you Joseph and Carlo for your assistance.
                  Kind regards
                  Ansuyah

                  Comment

                  Working...
                  X