Announcement

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

  • Calculating Change Scores for a regression

    I have a longitudinal data set that has 3 waves of survey data (wave 1, 2, 3). Nested within those waves, are 12 regions of a state. There are 5 scales (scale 1, scale 2, scale 3, scale 4, scale 5 (dependent variable)) with scores associated for each individual response (n=4202 observations).

    Here's what I need to do:

    First, examin if change in scale scores from Wave 1 to Wave 3 is associated with Wave 3 scale 5. I think I would tackle this by calculating for each region for each scale a change score (e.g., change score = wave 3 score – wave 1 score). Thus, for each scale I’d have 12 of these scores (e.g., one for each region). Separately from that, I need 12 Wave 3 scale 5 scores.

    Second, is examing if change in scale scores from Wave 1 to Wave 3 are associated with change in scale 5 scores from wave 1 to wave 3.

    Can anyone assist with the coding required for this? I am not super new to stata but I am unfamiliar with these types of calculations.

    Thank you



  • #2
    It is difficult to write code that will run on an imaginary data set. You have given a general description, but I could compose several different data sets that would match it, and each would require different code to accomplish what you ask.

    All who post are, when they create their thread, asked to read the Forum FAQ. It contains excellent advice about how to post questions efficiently, so as to maximize your chances of getting a timely and helpful response. Had you done that, you would have seen that providing an example of your Stata data set would be helpful here, and you would also, in #12, have learned that the helpful way to do that is with the -dataex- command. So please go back and read the FAQ, and then install -dataex- from SSC if you don't already have it, and then re-post, using -dataex- to show an example of your data.

    Your question is also a bit confusing. You ask about the association between certain things without qualification, but from your description of the process you envision, it sounds like you actually want separate estimates of association for each of the 12 regions, not an overall estimate--is that correct? Also, you need to decide what measure of association is most suited to your needs: a regression analysis? a correlation coefficient (and, if so, which kind)? A kappa statistic? What?

    Comment


    • #3
      Thank you for the reply. I am brand new here so I will take your recommendation and come back with a clearer post.

      Thanks again.

      Comment


      • #4
        Here is an example of my data set where I have the regions coded, waves of the data coded, and the scales in parenthesis represent the variables that I want to see change in. The last one, "EE_SUM_SCALE" is the dependent variable. And I want to find an overall estimate of associate for the regions. I've been asked to find change in the dependent variable (EE_SUM_SCALE) on change in the independent variable (SR_SUM_SCALE, PS_SUM_SCALE, etc.). I hope this is more helpful

        input byte Region_Code float wave double(SR_SUM_SCALE SO_SUM_SCALE PS_SUM_SCALE SC_SUM_SCALE EE_SUM_SCALE)
        3 0 57.12 65.19 64.25999999999999 57.120000000000005 49.98
        9 0 71.39999999999999 38.160000000000004 49.98 53.04 60.69
        12 0 28.56 71.55 71.39999999999999 53.04 28.56
        8 0 49.98 82.68 85.67999999999999 79.56 39.269999999999996
        9 0 57.12 73.14 60.69 67.32000000000001 32.129999999999995
        12 0 46.41 82.68 85.67999999999999 81.6 14.28
        8 0 89.25 57.24 60.69 69.36 64.25999999999999
        1 0 42.839999999999996 65.19 67.83 79.56 42.839999999999996
        3 0 99.96 57.24 64.25999999999999 69.36 96.39
        4 0 57.12 73.14 60.69 59.160000000000004 42.839999999999996
        5 0 89.25 84.27000000000001 71.39999999999999 79.56 64.25999999999999
        1 0 14.28 50.88 78.53999999999999 95.88 14.28
        7 0 60.69 68.37 60.69 57.120000000000005 24.99
        7 0 60.69 60.42 71.39999999999999 87.72 35.699999999999996
        12 0 57.12 85.86 67.83 85.68 35.699999999999996
        12 0 60.69 60.42 60.69 85.68 46.41
        4 0 64.25999999999999 30.21 32.129999999999995 42.84 78.53999999999999
        6 0 53.55 47.7 71.39999999999999 73.44 35.699999999999996
        9 0 53.55 54.06 60.69 81.6 35.699999999999996
        9 0 53.55 100.17 89.25 99.96000000000001 24.99
        3 0 57.12 57.24 57.12 57.120000000000005 57.12
        12 0 60.69 57.24 67.83 65.28 28.56
        6 0 71.39999999999999 36.57 49.98 81.6 67.83
        9 0 60.69 87.45 92.82 93.84 14.28
        9 0 46.41 71.55 74.97 85.68 32.129999999999995
        1 0 71.39999999999999 36.57 64.25999999999999 91.8 46.41
        2 0 53.55 73.14 78.53999999999999 81.6 24.99
        2 0 67.83 76.32000000000001 74.97 99.96000000000001 14.28
        1 0 74.97 50.88 89.25 79.56 67.83
        7 0 78.53999999999999 57.24 71.39999999999999 71.4 46.41
        4 0 53.55 49.29 57.12 83.64 42.839999999999996
        4 0 64.25999999999999 54.06 82.11 69.36 57.12
        9 0 71.39999999999999 76.32000000000001 67.83 75.48 42.839999999999996
        3 0 71.39999999999999 14.31 57.12 79.56 42.839999999999996
        5 0 49.98 85.86 60.69 97.92 28.56
        11 0 57.12 65.19 67.83 85.68 46.41
        12 0 53.55 47.7 60.69 97.92 24.99
        3 0 32.129999999999995 63.6 74.97 77.52 24.99
        1 0 53.55 60.42 64.25999999999999 63.24 57.12
        3 0 42.839999999999996 22.26 35.699999999999996 71.4 28.56
        1 0 71.39999999999999 71.55 92.82 83.64 46.41
        1 0 60.69 71.55 28.56 99.96000000000001 49.98
        1 0 42.839999999999996 25.44 35.699999999999996 57.120000000000005 57.12
        7 0 71.39999999999999 41.34 57.12 57.120000000000005 57.12
        9 0 67.83 60.42 67.83 83.64 67.83
        8 0 42.839999999999996 58.830000000000005 74.97 81.6 32.129999999999995
        9 0 32.129999999999995 85.86 89.25 77.52 14.28
        8 0 71.39999999999999 84.27000000000001 85.67999999999999 91.8 96.39
        4 0 57.12 57.24 67.83 77.52 42.839999999999996
        5 0 57.12 57.24 57.12 57.120000000000005 57.12
        5 0 42.839999999999996 71.55 67.83 71.4 42.839999999999996
        3 0 53.55 63.6 60.69 83.64 53.55

        Comment


        • #5
          Something is wrong with this data example. Your original post says wave is 1, 2, or 3. But in the example data, wave is always 0.

          And certainly to develop code in which one is looking to work with changes between waves 1 and 3, the example data needs to include observations on the same regions in both of those waves. I'm also still quite unclear what it is you're trying to calculate here.

          Nevertheless, I have a clear enough sense of how your data is set up to venture some code:

          Code:
          local predictors SR SO PS SC
          
          //    CALCULATE MEAN SCORES IN EACH REGION BY WAVE, FOR WAVES 1 and 3
          // keep if inlist(wave, 1, 3)
          collapse (mean) *_SUM_SCALE, by(Region_Code wave)
          
          //    GO WIDE SO WE HAVE ONE OBSERVATION PER REGION
          //    AND THEN CALCULATE CHANGES FROM WAVE 1 TO WAVE 3
          reshape wide *_SUM_SCALE, i(Region_Code) j(wave)
          foreach p of varlist `predictors' EE {
              gen `p'_change = `p'_SUM_SCALE3 - `p'_SUM_SCALE1
          }
          
          //    GET CORRELATIONS OF PREDICTOR SCALE CHANGES
          //    WITH OUTCOME SCALE CHANGE
          foreach p of local predictors {
              corr `p'_change EE_change
          }
          If this isn't along the lines you want, I suggest you repost with, a) a better data example that includes data from waves 1 and 3 on several of the regions, and b) a set of hand-worked results of the calculations as applied to that data example and an explanation of what you did to get it so I can better see what you are trying to arrive at.

          Added: The code shown above is not completely tested. It may contain errors, especially typos.

          Comment

          Working...
          X