Announcement

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

  • Create a variable measuring change of score from one wave to another

    There are three waves of data in the survey I use. My independent variable (a score) is continuous and dependent variable dichotomous. I would like to create a variable indicating change of the score from wave 1 to wave 2 and 2 to 3 to regress it on the dependent variable at waves 2 and 3. I am thinking of first creating a change variable
    Code:
    gen leadvar = score[_n+1]
    gen changevar = leadvar - score
    , and then should I just
    Code:
    xtlogit changevar devar
    ? Will this regress the independent variable on the right wave of dependent variable? Thank you.

  • #2
    There are some problems with this approach.

    If there are any respondents who missed a wave, then the calculation of leadvar will either return a missing value when it shouldn't, or will grab the score from the wrong year. Also, as written, in the final wave for any participant, leadvar will be the score in the first wave of the next participant. You can overcome these problems by using Stata's time-series operators. See -help tsvarlist- for details.

    Next, your variable score is a continuous variable, so there is no way you can expect that changevar will always be 0/1. You are going to get a new continuous variable. If you use that as the outcome in an -xtlogit-, it will be interpreted as true when changevar != 0 and false when changevar == 0. Maybe that's what you want. It's legal. But it's rarely what's intended, and even less often useful. I think you have it backwards. I think you want depvar to be the outcome in the regression.

    So I would do it as:


    Code:
    xtset participant_id wave
    xtlogit depvar D.score

    Comment


    • #3
      Thank you very much! D.score is the new variable indicating the difference between current wave value minus previous wave value. And you were right I did have the dep and indep variable backwards.

      Comment

      Working...
      X